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

Fixes #6217: Disallow passing of string values for integer custom fields

This commit is contained in:
jeremystretch
2021-06-02 16:12:11 -04:00
parent ca44cda112
commit 1658d7ae86
2 changed files with 2 additions and 3 deletions

View File

@@ -286,9 +286,7 @@ class CustomField(BigIDModel):
# Validate integer
if self.type == CustomFieldTypeChoices.TYPE_INTEGER:
try:
int(value)
except ValueError:
if type(value) is not int:
raise ValidationError("Value must be an integer.")
if self.validation_minimum is not None and value < self.validation_minimum:
raise ValidationError(f"Value must be at least {self.validation_minimum}")