8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-10-31 23:22:49 +00:00

Export complet du prefix v6

This commit is contained in:
Gabriel Detraz 2018-08-05 11:14:19 +02:00
parent cf3edceff5
commit 63748168f2
2 changed files with 6 additions and 1 deletions

View file

@ -673,7 +673,7 @@ class SubnetPortsOpenSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = machines.IpType model = machines.IpType
fields = ('type', 'domaine_ip_start', 'domaine_ip_stop', 'prefix_v6', 'ouverture_ports') fields = ('type', 'domaine_ip_start', 'domaine_ip_stop', 'complete_prefixv6', 'ouverture_ports')
# DHCP # DHCP

View file

@ -336,6 +336,11 @@ class IpType(RevMixin, AclMixin, models.Model):
else: else:
return None return None
@cached_property
def complete_prefixv6(self):
"""Return the complete prefix v6 as cidr"""
return str(self.prefix_v6) + "/" + str(self.prefix_v6_length)
def ip_objects(self): def ip_objects(self):
""" Renvoie tous les objets ipv4 relié à ce type""" """ Renvoie tous les objets ipv4 relié à ce type"""
return IpList.objects.filter(ip_type=self) return IpList.objects.filter(ip_type=self)