mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Use re2o.utils functions for optimization
This commit is contained in:
parent
a9cfc9aebc
commit
654da8cb04
1 changed files with 8 additions and 7 deletions
|
@ -563,21 +563,22 @@ class Extension(RevMixin, AclMixin, models.Model):
|
||||||
return entry
|
return entry
|
||||||
|
|
||||||
def get_associated_a_records(self):
|
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(type__ip_type__extension=self)
|
||||||
.filter(ipv4__isnull=False)
|
.filter(ipv4__isnull=False))
|
||||||
.prefetch_related('domain')
|
|
||||||
.prefetch_related('ipv4'))
|
|
||||||
|
|
||||||
def get_associated_aaaa_records(self):
|
def get_associated_aaaa_records(self):
|
||||||
return (Interface.objects
|
from re2o.utils import all_active_interfaces
|
||||||
.filter(type__ip_type__extension=self)
|
return (all_active_interfaces(full=True)
|
||||||
.prefetch_related('domain'))
|
.filter(type__ip_type__extension=self))
|
||||||
|
|
||||||
def get_associated_cname_records(self):
|
def get_associated_cname_records(self):
|
||||||
|
from re2o.utils import all_active_assigned_interfaces
|
||||||
return (Domain.objects
|
return (Domain.objects
|
||||||
.filter(extension=self)
|
.filter(extension=self)
|
||||||
.filter(cname__isnull=False)
|
.filter(cname__isnull=False)
|
||||||
|
.filter(interface_parent__in=all_active_assigned_interfaces())
|
||||||
.prefetch_related('cname'))
|
.prefetch_related('cname'))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in a new issue