From 1d65378886990a1dc5c36403d454ce251fbda457 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 9 Mar 2015 10:18:32 +0000 Subject: Update documentation --- api-guide/validators/index.html | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'api-guide/validators') diff --git a/api-guide/validators/index.html b/api-guide/validators/index.html index 395fd9de..d97fc213 100644 --- a/api-guide/validators/index.html +++ b/api-guide/validators/index.html @@ -424,10 +424,7 @@ -
-

Note: This is the documentation for the version 3.0 of REST framework. Documentation for version 2.4 is also available.

-
-

Validators

+

Validators

Validators can be useful for re-using validation logic between different types of fields.

Django documentation

@@ -446,7 +443,7 @@

Example

As an example of how REST framework uses explicit validation, we'll take a simple model class that has a field with a uniqueness constraint.

class CustomerReportRecord(models.Model):
-    time_raised = models.DateTimeField(default=timezone.now, editable=False) 
+    time_raised = models.DateTimeField(default=timezone.now, editable=False)
     reference = models.CharField(unique=True, max_length=20)
     description = models.TextField()
 
@@ -455,7 +452,7 @@ class Meta: model = CustomerReportRecord -

If we open up the Django shell using manage.py shell we can now

+

If we open up the Django shell using manage.py shell we can now

>>> from project.example.serializers import CustomerReportSerializer
 >>> serializer = CustomerReportSerializer()
 >>> print(repr(serializer))
-- 
cgit v1.2.3