mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 08:38:16 -06:00
16992 fix custom validator
This commit is contained in:
parent
ad6042b80a
commit
72fa057c2f
@ -14,7 +14,7 @@ from utilities.request import NetBoxFakeRequest
|
|||||||
|
|
||||||
class MyValidator(CustomValidator):
|
class MyValidator(CustomValidator):
|
||||||
|
|
||||||
def validate(self, instance):
|
def validate(self, instance, request):
|
||||||
if instance.name != 'foo':
|
if instance.name != 'foo':
|
||||||
self.fail("Name must be foo!")
|
self.fail("Name must be foo!")
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class CustomValidator:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Execute custom validation logic (if any)
|
# Execute custom validation logic (if any)
|
||||||
self.validate(instance)
|
self.validate(instance, request)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_request_attr(request, name):
|
def _get_request_attr(request, name):
|
||||||
|
Loading…
Reference in New Issue
Block a user