mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
ip_set_full_info
This commit is contained in:
parent
998d093cac
commit
eca223cdc4
1 changed files with 17 additions and 0 deletions
|
@ -285,11 +285,28 @@ class IpType(RevMixin, AclMixin, models.Model):
|
|||
""" Renvoie une IPSet à partir de l'iptype"""
|
||||
return IPSet(self.ip_range)
|
||||
|
||||
@cached_property
|
||||
def ip_set_cidrs_as_str(self):
|
||||
"""Renvoie la liste des cidrs du range en str"""
|
||||
return [str(ip_range) for ip_range in self.ip_set.iter_cidrs()]
|
||||
|
||||
@cached_property
|
||||
def ip_set_as_str(self):
|
||||
""" Renvoie une liste des ip en string"""
|
||||
return [str(x) for x in self.ip_set]
|
||||
|
||||
@cached_property
|
||||
def ip_set_full_info(self):
|
||||
"""Iter sur les range cidr, et renvoie network, broacast , etc"""
|
||||
return [
|
||||
{
|
||||
'network': str(ip_set.network),
|
||||
'netmask': str(ip_set.netmask),
|
||||
'broacast': str(ip_set.broadcast),
|
||||
} for ip_set in self.ip_set.iter_cidrs()
|
||||
]
|
||||
|
||||
|
||||
def ip_objects(self):
|
||||
""" Renvoie tous les objets ipv4 relié à ce type"""
|
||||
return IpList.objects.filter(ip_type=self)
|
||||
|
|
Loading…
Reference in a new issue