From dc1b6026e92ea14e8c4800a62228a88605f1a985 Mon Sep 17 00:00:00 2001 From: aronysidoro Date: Sat, 5 Nov 2016 14:49:44 +0100 Subject: [PATCH] Add documentation link for single 'field-level validation' to the Validator docs page (#3772) --- docs/api-guide/validators.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md index 9df15ec15..1af9f02a5 100644 --- a/docs/api-guide/validators.md +++ b/docs/api-guide/validators.md @@ -272,6 +272,12 @@ A validator may be any callable that raises a `serializers.ValidationError` on f if value % 2 != 0: raise serializers.ValidationError('This field must be an even number.') +#### Field-level validation + +You can specify custom field-level validation by adding `.validate_` methods +to your `Serializer` subclass. This is documented in the +[Serializer docs](http://www.django-rest-framework.org/api-guide/serializers/#field-level-validation) + ## Class-based To write a class-based validator, use the `__call__` method. Class-based validators are useful as they allow you to parameterize and reuse behavior.