Explorar el Código

Fixes #3876: set min and max values for ASN field

Saria Hajjar hace 6 años
padre
commit
4eacc57522
Se han modificado 2 ficheros con 6 adiciones y 0 borrados
  1. 1 0
      docs/release-notes/version-2.6.md
  2. 5 0
      netbox/dcim/fields.py

+ 1 - 0
docs/release-notes/version-2.6.md

@@ -21,6 +21,7 @@
 * [#3862](https://github.com/netbox-community/netbox/issues/3862) - Allow filtering device components by multiple device names
 * [#3862](https://github.com/netbox-community/netbox/issues/3862) - Allow filtering device components by multiple device names
 * [#3864](https://github.com/netbox-community/netbox/issues/3864) - Disallow /0 masks
 * [#3864](https://github.com/netbox-community/netbox/issues/3864) - Disallow /0 masks
 * [#3872](https://github.com/netbox-community/netbox/issues/3872) - Paginate related IPs of an address
 * [#3872](https://github.com/netbox-community/netbox/issues/3872) - Paginate related IPs of an address
+* [#3876](https://github.com/netbox-community/netbox/issues/3876) - Fixed min/max to ASN input field at the site creation page
 
 
 ---
 ---
 
 

+ 5 - 0
netbox/dcim/fields.py

@@ -11,6 +11,11 @@ class ASNField(models.BigIntegerField):
         MaxValueValidator(4294967295),
         MaxValueValidator(4294967295),
     ]
     ]
 
 
+    def formfield(self, **kwargs):
+        defaults = {'min_value': 1, 'max_value': 4294967295}
+        defaults.update(**kwargs)
+        return super().formfield(**defaults)
+
 
 
 class mac_unix_expanded_uppercase(mac_unix_expanded):
 class mac_unix_expanded_uppercase(mac_unix_expanded):
     word_fmt = '%.2X'
     word_fmt = '%.2X'