mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Rename fail() kwarg from attr to field
This commit is contained in:
@ -63,10 +63,10 @@ class CustomValidator:
|
||||
"""
|
||||
return
|
||||
|
||||
def fail(self, message, attr=None):
|
||||
def fail(self, message, field=None):
|
||||
"""
|
||||
Raise a ValidationError exception. Associate the provided message with an attribute if specified.
|
||||
Raise a ValidationError exception. Associate the provided message with a form/serializer field if specified.
|
||||
"""
|
||||
if attr is not None:
|
||||
raise ValidationError({attr: message})
|
||||
if field is not None:
|
||||
raise ValidationError({field: message})
|
||||
raise ValidationError(message)
|
||||
|
Reference in New Issue
Block a user