Skip to content

Commit 614bd87

Browse files
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.
1 parent 1ae812e commit 614bd87

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/api-guide/validators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ A validator may be any callable that raises a `serializers.ValidationError` on f
271271
def even_number(value):
272272
if value % 2 != 0:
273273
raise serializers.ValidationError('This field must be an even number.')
274+
return value
274275

275276
#### Field-level validation
276277

0 commit comments

Comments
 (0)