mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-22 21:32:23 -06:00
* Fixes #19415: Increased Circuit/WirelessLink absolute distance upper limit Also adds form validation that provides a useful message to the user rather than a 500 error with potentially little information. * Include forgotten migration files * Remove unnecessary comments * Remove more unnecessary comments * Addresses PR feedback * Gah, remove django migration header comment * Clean up new has_field_errors mechanism, fix issue with ObjectAttribute * Address PR feedback, revert changes to render_fieldset template tag
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import time
|
||||
from decimal import Decimal
|
||||
|
||||
from django import forms
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
__all__ = (
|
||||
'CheckLastUpdatedMixin',
|
||||
'DistanceValidationMixin',
|
||||
)
|
||||
|
||||
|
||||
@@ -44,3 +47,13 @@ class CheckLastUpdatedMixin(forms.Form):
|
||||
"This object has been modified since the form was rendered. Please consult the object's change "
|
||||
"log for details."
|
||||
))
|
||||
|
||||
|
||||
class DistanceValidationMixin(forms.Form):
|
||||
distance = forms.DecimalField(
|
||||
required=False,
|
||||
validators=[
|
||||
MinValueValidator(Decimal(0)),
|
||||
MaxValueValidator(Decimal(100000)),
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user