8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Use re2o.utils functions for optimization

This commit is contained in:
Maël Kervella 2018-06-23 21:36:01 +00:00
parent a9cfc9aebc
commit 654da8cb04

View file

@ -563,21 +563,22 @@ class Extension(RevMixin, AclMixin, models.Model):
return entry
def get_associated_a_records(self):
return (Interface.objects
from re2o.utils import all_active_assigned_interfaces
return (all_active_assigned_interfaces()
.filter(type__ip_type__extension=self)
.filter(ipv4__isnull=False)
.prefetch_related('domain')
.prefetch_related('ipv4'))
.filter(ipv4__isnull=False))
def get_associated_aaaa_records(self):
return (Interface.objects
.filter(type__ip_type__extension=self)
.prefetch_related('domain'))
from re2o.utils import all_active_interfaces
return (all_active_interfaces(full=True)
.filter(type__ip_type__extension=self))
def get_associated_cname_records(self):
from re2o.utils import all_active_assigned_interfaces
return (Domain.objects
.filter(extension=self)
.filter(cname__isnull=False)
.filter(interface_parent__in=all_active_assigned_interfaces())
.prefetch_related('cname'))
@staticmethod