Move BGP_ASN_MIN and BGP_ASN_MAX to ipam.constants

This commit is contained in:
Jeremy Stretch
2020-01-15 14:53:46 -05:00
parent dfbd3b8bf7
commit 85548a7eea
4 changed files with 15 additions and 7 deletions

View File

@@ -3,7 +3,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator
from django.db import models
from netaddr import AddrFormatError, EUI, mac_unix_expanded
from .constants import *
from ipam.constants import BGP_ASN_MAX, BGP_ASN_MIN
class ASNField(models.BigIntegerField):
@@ -14,7 +14,10 @@ class ASNField(models.BigIntegerField):
]
def formfield(self, **kwargs):
defaults = {'min_value': BGP_ASN_MIN, 'max_value': BGP_ASN_MAX}
defaults = {
'min_value': BGP_ASN_MIN,
'max_value': BGP_ASN_MAX,
}
defaults.update(**kwargs)
return super().formfield(**defaults)