mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 09:26:27 +00:00
Ading prefix_v6_length field to IpType
This commit is contained in:
parent
0220920067
commit
fc612f47dc
4 changed files with 35 additions and 6 deletions
|
@ -219,7 +219,8 @@ class IpTypeForm(FormRevMixin, ModelForm):
|
|||
model = IpType
|
||||
fields = ['type', 'extension', 'need_infra', 'domaine_ip_start',
|
||||
'domaine_ip_stop', 'dnssec_reverse_v4', 'prefix_v6',
|
||||
'dnssec_reverse_v6', 'vlan', 'ouverture_ports']
|
||||
'prefix_v6_length','dnssec_reverse_v6', 'vlan',
|
||||
'ouverture_ports']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||
|
@ -231,8 +232,8 @@ class EditIpTypeForm(IpTypeForm):
|
|||
"""Edition d'un iptype. Pas d'edition du rangev4 possible, car il faudrait
|
||||
synchroniser les objets iplist"""
|
||||
class Meta(IpTypeForm.Meta):
|
||||
fields = ['extension', 'type', 'need_infra', 'prefix_v6', 'vlan',
|
||||
'dnssec_reverse_v4', 'dnssec_reverse_v6',
|
||||
fields = ['extension', 'type', 'need_infra', 'prefix_v6', 'prefix_v6_length',
|
||||
'vlan', 'dnssec_reverse_v4', 'dnssec_reverse_v6',
|
||||
'ouverture_ports']
|
||||
|
||||
|
||||
|
|
21
machines/migrations/0095_iptype_prefix_v6_length.py
Normal file
21
machines/migrations/0095_iptype_prefix_v6_length.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2018-07-16 18:46
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('machines', '0094_role_specific_role'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='iptype',
|
||||
name='prefix_v6_length',
|
||||
field=models.IntegerField(default=64, validators=[django.core.validators.MaxValueValidator(128), django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
]
|
|
@ -39,7 +39,7 @@ from django.dispatch import receiver
|
|||
from django.forms import ValidationError
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils import timezone
|
||||
from django.core.validators import MaxValueValidator
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
|
||||
from macaddress.fields import MACAddressField
|
||||
|
||||
|
@ -343,6 +343,13 @@ class IpType(RevMixin, AclMixin, models.Model):
|
|||
null=True,
|
||||
blank=True
|
||||
)
|
||||
prefix_v6_length = models.IntegerField(
|
||||
default=64,
|
||||
validators=[
|
||||
MaxValueValidator(128),
|
||||
MinValueValidator(0)
|
||||
]
|
||||
)
|
||||
dnssec_reverse_v6 = models.BooleanField(
|
||||
default=False,
|
||||
help_text="Activer DNSSEC sur le reverse DNS IPv6",
|
||||
|
@ -405,7 +412,7 @@ class IpType(RevMixin, AclMixin, models.Model):
|
|||
return {
|
||||
'network' : str(self.prefix_v6),
|
||||
'netmask' : 'ffff:ffff:ffff:ffff::',
|
||||
'netmask_cidr' : '64',
|
||||
'netmask_cidr' : str(self.prefix_v6_length),
|
||||
'vlan': str(self.vlan),
|
||||
'vlan_id': self.vlan.vlan_id
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<td>{{ type.extension }}</td>
|
||||
<td>{{ type.need_infra }}</td>
|
||||
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}</td>
|
||||
<td>{{ type.prefix_v6 }}</td>
|
||||
<td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td>
|
||||
<td>{{ type.dnssec_reverse_v4 }}/{{ type.dnssec_reverse_v6 }}</td>
|
||||
<td>{{ type.vlan }}</td>
|
||||
<td>{{ type.ouverture_ports }}</td>
|
||||
|
|
Loading…
Reference in a new issue