Skip to content

Commit 0b93040

Browse files
Aaron Leleviertomchristie
Aaron Lelevier
authored andcommitted
Add documentation link for single 'field-level validation' to the Validator docs page (encode#3772) (encode#4657)
1 parent 7f43712 commit 0b93040

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/api-guide/validators.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ A validator may be any callable that raises a `serializers.ValidationError` on f
272272
if value % 2 != 0:
273273
raise serializers.ValidationError('This field must be an even number.')
274274

275+
#### Field-level validation
276+
277+
You can specify custom field-level validation by adding `.validate_<field_name>` methods
278+
to your `Serializer` subclass. This is documented in the
279+
[Serializer docs](http://www.django-rest-framework.org/api-guide/serializers/#field-level-validation)
280+
275281
## Class-based
276282

277283
To write a class-based validator, use the `__call__` method. Class-based validators are useful as they allow you to parameterize and reuse behavior.

0 commit comments

Comments
 (0)