mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-21 17:16:47 +03:00
Fix bug in validators documentation (#8779)
Function validators seem to have to return their value (which will become part of `validated_data`) as part of their signature.
This commit is contained in:
parent
1ae812ea20
commit
614bd87b60
|
@ -271,6 +271,7 @@ A validator may be any callable that raises a `serializers.ValidationError` on f
|
|||
def even_number(value):
|
||||
if value % 2 != 0:
|
||||
raise serializers.ValidationError('This field must be an even number.')
|
||||
return value
|
||||
|
||||
#### Field-level validation
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user