aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Padilla2015-03-07 10:49:56 -0400
committerJosé Padilla2015-03-07 10:49:56 -0400
commitd12de927adaac6018f3e8c232307b76372fe3527 (patch)
treec3a81d83421e761ef5f55c78f61aa29b3539ef4c
parent2ddb6bfa70036bc1182a768807362b4e46a1b67b (diff)
downloaddjango-rest-framework-d12de927adaac6018f3e8c232307b76372fe3527.tar.bz2
Remove docs for 3.0 banners
-rw-r--r--docs/api-guide/fields.md6
-rw-r--r--docs/api-guide/generic-views.md6
-rw-r--r--docs/api-guide/metadata.md8
-rw-r--r--docs/api-guide/relations.md6
-rw-r--r--docs/api-guide/requests.md6
-rw-r--r--docs/api-guide/serializers.md8
-rw-r--r--docs/api-guide/validators.md14
7 files changed, 6 insertions, 48 deletions
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md
index f113bb23..5edc997a 100644
--- a/docs/api-guide/fields.md
+++ b/docs/api-guide/fields.md
@@ -1,11 +1,5 @@
source: fields.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Serializer fields
> Each field in a Form class is responsible not only for validating data, but also for "cleaning" it — normalizing it to a consistent format.
diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md
index 39e09aaa..7df3d6ff 100644
--- a/docs/api-guide/generic-views.md
+++ b/docs/api-guide/generic-views.md
@@ -1,12 +1,6 @@
source: mixins.py
generics.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Generic views
> Django’s generic views... were developed as a shortcut for common usage patterns... They take certain common idioms and patterns found in view development and abstract them so that you can quickly write common views of data without having to repeat yourself.
diff --git a/docs/api-guide/metadata.md b/docs/api-guide/metadata.md
index 247ae988..01727440 100644
--- a/docs/api-guide/metadata.md
+++ b/docs/api-guide/metadata.md
@@ -1,11 +1,5 @@
source: metadata.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Metadata
> [The `OPTIONS`] method allows a client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.
@@ -59,7 +53,7 @@ Or you can set the metadata class individually for a view:
class APIRoot(APIView):
metadata_class = APIRootMetadata
-
+
def get(self, request, format=None):
return Response({
...
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md
index 50e3b7b5..093bbdd0 100644
--- a/docs/api-guide/relations.md
+++ b/docs/api-guide/relations.md
@@ -1,11 +1,5 @@
source: relations.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Serializer relations
> Bad programmers worry about the code.
diff --git a/docs/api-guide/requests.md b/docs/api-guide/requests.md
index c993dfae..658a5ffd 100644
--- a/docs/api-guide/requests.md
+++ b/docs/api-guide/requests.md
@@ -1,11 +1,5 @@
source: request.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Requests
> If you're doing REST-based web service stuff ... you should ignore request.POST.
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index 940eb424..aad2236f 100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -1,11 +1,5 @@
source: serializers.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Serializers
> Expanding the usefulness of the serializers is something that we would
@@ -23,7 +17,7 @@ The serializers in REST framework work very similarly to Django's `Form` and `Mo
Let's start by creating a simple object we can use for example purposes:
from datetime import datetime
-
+
class Comment(object):
def __init__(self, email, content, created=None):
self.email = email
diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md
index 8f5a8929..40ad4857 100644
--- a/docs/api-guide/validators.md
+++ b/docs/api-guide/validators.md
@@ -1,11 +1,5 @@
source: validators.py
----
-
-**Note**: This is the documentation for the **version 3.0** of REST framework. Documentation for [version 2.4](http://tomchristie.github.io/rest-framework-2-docs/) is also available.
-
----
-
# Validators
> Validators can be useful for re-using validation logic between different types of fields.
@@ -33,7 +27,7 @@ When you're using `ModelSerializer` all of this is handled automatically for you
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()
@@ -43,7 +37,7 @@ Here's a basic `ModelSerializer` that we can use for creating or updating instan
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()
@@ -204,7 +198,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.')
+ raise serializers.ValidationError('This field must be an even number.')
## Class based
@@ -213,7 +207,7 @@ To write a class based validator, use the `__call__` method. Class based validat
class MultipleOf:
def __init__(self, base):
self.base = base
-
+
def __call__(self, value):
if value % self.base != 0
message = 'This field must be a multiple of %d.' % self.base