From b9a4dd6d65579322df9195faefb727a2d5d4484d Mon Sep 17 00:00:00 2001 From: Charlie Jacomme Date: Tue, 7 Aug 2018 09:57:59 +0200 Subject: [PATCH] ptr are empty if revere disabled --- machines/models.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/machines/models.py b/machines/models.py index 2bf362eb..b9fd9205 100644 --- a/machines/models.py +++ b/machines/models.py @@ -450,14 +450,20 @@ class IpType(RevMixin, AclMixin, models.Model): def get_associated_ptr_records(self): from re2o.utils import all_active_assigned_interfaces - return (all_active_assigned_interfaces() - .filter(type__ip_type=self) - .filter(ipv4__isnull=False)) + if self.reverse_v4: + return (all_active_assigned_interfaces() + .filter(type__ip_type=self) + .filter(ipv4__isnull=False)) + else: + return None def get_associated_ptr_v6_records(self): from re2o.utils import all_active_interfaces - return (all_active_interfaces(full=True) - .filter(type__ip_type=self)) + if self.reverse_v6: + return (all_active_interfaces(full=True) + .filter(type__ip_type=self)) + else: + return None def clean(self): """ Nettoyage. VĂ©rifie :