|
@@ -1,5 +1,6 @@
|
|
|
import netaddr
|
|
import netaddr
|
|
|
from django.contrib.contenttypes.fields import GenericForeignKey
|
|
from django.contrib.contenttypes.fields import GenericForeignKey
|
|
|
|
|
+from django.contrib.postgres.indexes import GistIndex
|
|
|
from django.core.exceptions import ValidationError
|
|
from django.core.exceptions import ValidationError
|
|
|
from django.db import models
|
|
from django.db import models
|
|
|
from django.db.models import F
|
|
from django.db.models import F
|
|
@@ -281,6 +282,13 @@ class Prefix(ContactsMixin, GetAvailablePrefixesMixin, CachedScopeMixin, Primary
|
|
|
ordering = (F('vrf').asc(nulls_first=True), 'prefix', 'pk') # (vrf, prefix) may be non-unique
|
|
ordering = (F('vrf').asc(nulls_first=True), 'prefix', 'pk') # (vrf, prefix) may be non-unique
|
|
|
verbose_name = _('prefix')
|
|
verbose_name = _('prefix')
|
|
|
verbose_name_plural = _('prefixes')
|
|
verbose_name_plural = _('prefixes')
|
|
|
|
|
+ indexes = [
|
|
|
|
|
+ GistIndex(
|
|
|
|
|
+ fields=['prefix'],
|
|
|
|
|
+ name='ipam_prefix_gist_idx',
|
|
|
|
|
+ opclasses=['inet_ops'],
|
|
|
|
|
+ ),
|
|
|
|
|
+ ]
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
def __init__(self, *args, **kwargs):
|
|
|
super().__init__(*args, **kwargs)
|
|
super().__init__(*args, **kwargs)
|