aboutsummaryrefslogtreecommitdiffstats
path: root/docs/api-guide
diff options
context:
space:
mode:
Diffstat (limited to 'docs/api-guide')
-rw-r--r--docs/api-guide/fields.md4
-rw-r--r--docs/api-guide/filtering.md2
-rw-r--r--docs/api-guide/generic-views.md4
-rw-r--r--docs/api-guide/relations.md2
4 files changed, 6 insertions, 6 deletions
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md
index 5edc997a..c87db785 100644
--- a/docs/api-guide/fields.md
+++ b/docs/api-guide/fields.md
@@ -434,7 +434,7 @@ A field class that does not take a value based on user input, but instead takes
For example, to include a field that always provides the current time as part of the serializer validated data, you would use the following:
- modified = serializer.HiddenField(default=timezone.now)
+ modified = serializers.HiddenField(default=timezone.now)
The `HiddenField` class is usually only needed if you have some validation that needs to run based on some pre-provided field values, but you do not want to expose all of those fields to the end user.
@@ -481,7 +481,7 @@ If you want to create a custom field, you'll need to subclass `Field` and then o
The `.to_representation()` method is called to convert the initial datatype into a primitive, serializable datatype.
-The `to_internal_value()` method is called to restore a primitive datatype into its internal python representation. This method should raise a `serializer.ValidationError` if the data is invalid.
+The `to_internal_value()` method is called to restore a primitive datatype into its internal python representation. This method should raise a `serializers.ValidationError` if the data is invalid.
Note that the `WritableField` class that was present in version 2.x no longer exists. You should subclass `Field` and override `to_internal_value()` if the field supports data input.
diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md
index b16b6be5..50c3f2cf 100644
--- a/docs/api-guide/filtering.md
+++ b/docs/api-guide/filtering.md
@@ -72,7 +72,7 @@ We can override `.get_queryset()` to deal with URLs such as `http://example.com/
by filtering against a `username` query parameter in the URL.
"""
queryset = Purchase.objects.all()
- username = self.request.QUERY_PARAMS.get('username', None)
+ username = self.request.query_params.get('username', None)
if username is not None:
queryset = queryset.filter(purchaser__username=username)
return queryset
diff --git a/docs/api-guide/generic-views.md b/docs/api-guide/generic-views.md
index 7df3d6ff..ccf84592 100644
--- a/docs/api-guide/generic-views.md
+++ b/docs/api-guide/generic-views.md
@@ -133,9 +133,9 @@ May be overridden to provide more complex behavior with filters, such as using d
For example:
def get_filter_backends(self):
- if "geo_route" in self.request.QUERY_PARAMS:
+ if "geo_route" in self.request.query_params:
return (GeoRouteFilter, CategoryFilter)
- elif "geo_point" in self.request.QUERY_PARAMS:
+ elif "geo_point" in self.request.query_params:
return (GeoPointFilter, CategoryFilter)
return (CategoryFilter,)
diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md
index 093bbdd0..31d59e1f 100644
--- a/docs/api-guide/relations.md
+++ b/docs/api-guide/relations.md
@@ -46,7 +46,7 @@ In order to explain the various types of relational fields, we'll use a couple o
class Meta:
unique_together = ('album', 'order')
- order_by = 'order'
+ ordering = ['order']
def __unicode__(self):
return '%d: %s' % (self.order, self.title)