diff --git a/README.md b/README.md index a8e1afbf1..179f2891a 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,7 @@ REST framework commercially we strongly encourage you to invest in its continued development by **[signing up for a paid plan][funding]**. The initial aim is to provide a single full-time position on REST framework. -Right now we're over 58% of the way towards achieving that. -*Every single sign-up makes a significant impact.* +*Every single sign-up makes a significant impact towards making that possible.*
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md
index a7ad4f70c..f986f1508 100644
--- a/docs/api-guide/fields.md
+++ b/docs/api-guide/fields.md
@@ -49,7 +49,9 @@ Defaults to `False`
### `default`
-If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behavior is to not populate the attribute at all.
+If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behaviour is to not populate the attribute at all.
+
+The `default` is not applied during partial update operations. In the partial update case only fields that are provided in the incoming data will have a validated value returned.
May be set to a function or other callable, in which case the value will be evaluated each time it is used. When called, it will receive no arguments. If the callable has a `set_context` method, that will be called each time before getting the value with the field instance as only argument. This works the same way as for [validators](validators.md#using-set_context).
@@ -486,7 +488,7 @@ This field is used by default with `ModelSerializer` when including field names
**Signature**: `ReadOnlyField()`
-For example, is `has_expired` was a property on the `Account` model, then the following serializer would automatically generate it as a `ReadOnlyField`:
+For example, if `has_expired` was a property on the `Account` model, then the following serializer would automatically generate it as a `ReadOnlyField`:
class AccountSerializer(serializers.ModelSerializer):
class Meta:
diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md
index 8664dcc8a..0ccd51dd3 100644
--- a/docs/api-guide/filtering.md
+++ b/docs/api-guide/filtering.md
@@ -241,7 +241,6 @@ For more details on using filter sets see the [django-filter documentation][djan
* By default filtering is not enabled. If you want to use `DjangoFilterBackend` remember to make sure it is installed by using the `'DEFAULT_FILTER_BACKENDS'` setting.
* When using boolean fields, you should use the values `True` and `False` in the URL query parameters, rather than `0`, `1`, `true` or `false`. (The allowed boolean values are currently hardwired in Django's [NullBooleanSelect implementation][nullbooleanselect].)
* `django-filter` supports filtering across relationships, using Django's double-underscore syntax.
-* For Django 1.3 support, make sure to install `django-filter` version 0.5.4, as later versions drop support for 1.3.
---
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md
index 402875cd5..e0838e94a 100644
--- a/docs/api-guide/permissions.md
+++ b/docs/api-guide/permissions.md
@@ -132,7 +132,7 @@ This permission is suitable if you want to your API to allow read permissions to
## DjangoModelPermissions
-This permission class ties into Django's standard `django.contrib.auth` [model permissions][contribauth]. This permission must only be applied to views that has a `.queryset` property set. Authorization will only be granted if the user *is authenticated* and has the *relevant model permissions* assigned.
+This permission class ties into Django's standard `django.contrib.auth` [model permissions][contribauth]. This permission must only be applied to views that have a `.queryset` property set. Authorization will only be granted if the user *is authenticated* and has the *relevant model permissions* assigned.
* `POST` requests require the user to have the `add` permission on the model.
* `PUT` and `PATCH` requests require the user to have the `change` permission on the model.
diff --git a/docs/api-guide/throttling.md b/docs/api-guide/throttling.md
index 4eef4fd5d..51d2beef1 100644
--- a/docs/api-guide/throttling.md
+++ b/docs/api-guide/throttling.md
@@ -184,6 +184,8 @@ If the `.wait()` method is implemented and the request is throttled, then a `Ret
The following is an example of a rate throttle, that will randomly throttle 1 in every 10 requests.
+ import random
+
class RandomRateThrottle(throttling.BaseThrottle):
def allow_request(self, request, view):
return random.randint(1, 10) == 1
diff --git a/docs/api-guide/validators.md b/docs/api-guide/validators.md
index a059f1197..f04c74c3c 100644
--- a/docs/api-guide/validators.md
+++ b/docs/api-guide/validators.md
@@ -64,6 +64,8 @@ It takes a single required argument, and an optional `messages` argument:
This validator should be applied to *serializer fields*, like so:
+ from rest_framework.validators import UniqueValidator
+
slug = SlugField(
max_length=100,
validators=[UniqueValidator(queryset=BlogPost.objects.all())]
@@ -80,6 +82,8 @@ It has two required arguments, and a single optional `messages` argument:
The validator should be applied to *serializer classes*, like so:
+ from rest_framework.validators import UniqueTogetherValidator
+
class ExampleSerializer(serializers.Serializer):
# ...
class Meta:
@@ -114,6 +118,8 @@ These validators can be used to enforce the `unique_for_date`, `unique_for_month
The validator should be applied to *serializer classes*, like so:
+ from rest_framework.validators import UniqueForYearValidator
+
class ExampleSerializer(serializers.Serializer):
# ...
class Meta:
@@ -183,7 +189,7 @@ It takes a single argument, which is the default value or callable that should b
created_at = serializers.DateTimeField(
read_only=True,
- default=CreateOnlyDefault(timezone.now)
+ default=serializers.CreateOnlyDefault(timezone.now)
)
---
diff --git a/docs/api-guide/versioning.md b/docs/api-guide/versioning.md
index 54aa0170d..29672c96e 100644
--- a/docs/api-guide/versioning.md
+++ b/docs/api-guide/versioning.md
@@ -71,8 +71,8 @@ You can also set the versioning scheme on an individual view. Typically you won'
The following settings keys are also used to control versioning:
* `DEFAULT_VERSION`. The value that should be used for `request.version` when no versioning information is present. Defaults to `None`.
-* `ALLOWED_VERSIONS`. If set, this value will restrict the set of versions that may be returned by the versioning scheme, and will raise an error if the provided version if not in this set. Note that the value used for the `DEFAULT_VERSION` setting is always considered to be part of the `ALLOWED_VERSIONS` set. Defaults to `None`.
-* `VERSION_PARAM`. The string that should used for any versioning parameters, such as in the media type or URL query parameters. Defaults to `'version'`.
+* `ALLOWED_VERSIONS`. If set, this value will restrict the set of versions that may be returned by the versioning scheme, and will raise an error if the provided version is not in this set. Note that the value used for the `DEFAULT_VERSION` setting is always considered to be part of the `ALLOWED_VERSIONS` set (unless it is `None`). Defaults to `None`.
+* `VERSION_PARAM`. The string that should be used for any versioning parameters, such as in the media type or URL query parameters. Defaults to `'version'`.
You can also set your versioning class plus those three values on a per-view or a per-viewset basis by defining your own versioning scheme and using the `default_version`, `allowed_versions` and `version_param` class variables. For example, if you want to use `URLPathVersioning`:
diff --git a/docs/index.md b/docs/index.md
index 87e013b8e..88276e678 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -68,8 +68,7 @@ REST framework commercially we strongly encourage you to invest in its
continued development by **[signing up for a paid plan][funding]**.
The initial aim is to provide a single full-time position on REST framework.
-Right now we're over 58% of the way towards achieving that.
-*Every single sign-up makes a significant impact.*
+*Every single sign-up makes a significant impact towards making that possible.*