1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Remove dependency on RawSQL from IPAddress manager

This commit is contained in:
Jeremy Stretch
2020-02-19 17:17:41 -05:00
parent 7a53e24f97
commit 1130f6b9f0
2 changed files with 18 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
from django.db import models
from django.db.models.expressions import RawSQL
from ipam.lookups import Host, Inet
class IPAddressManager(models.Manager):
@@ -13,4 +14,4 @@ class IPAddressManager(models.Manager):
IP address as a /32 or /128.
"""
qs = super().get_queryset()
return qs.annotate(host=RawSQL('INET(HOST(ipam_ipaddress.address))', [])).order_by('family', 'host')
return qs.order_by('family', Inet(Host('address')))