diff options
| author | José Padilla | 2014-12-01 11:26:50 -0400 |
|---|---|---|
| committer | José Padilla | 2014-12-01 11:26:50 -0400 |
| commit | 080fa4f5f863609f5647ce1424f13b01e9f427ad (patch) | |
| tree | bdc38ab0360eb7ff2bdeb2af345a370157f17e43 /docs/topics | |
| parent | 555c450497e96bf8fed82fc76e70adf907c5c409 (diff) | |
| download | django-rest-framework-080fa4f5f863609f5647ce1424f13b01e9f427ad.tar.bz2 | |
Change allow_none to allow_null
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/3.0-announcement.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/topics/3.0-announcement.md b/docs/topics/3.0-announcement.md index 4aafb3d8..8791ad08 100644 --- a/docs/topics/3.0-announcement.md +++ b/docs/topics/3.0-announcement.md @@ -557,22 +557,22 @@ We now use the following: * `Field` is the base class for all fields. It does not include any default implementation for either serializing or deserializing data. * `ReadOnlyField` is a concrete implementation for read-only fields that simply returns the attribute value without modification. -#### The `required`, `allow_none`, `allow_blank` and `default` arguments. +#### The `required`, `allow_null`, `allow_blank` and `default` arguments. REST framework now has more explicit and clear control over validating empty values for fields. Previously the meaning of the `required=False` keyword argument was underspecified. In practice its use meant that a field could either be not included in the input, or it could be included, but be `None` or the empty string. -We now have a better separation, with separate `required`, `allow_none` and `allow_blank` arguments. +We now have a better separation, with separate `required`, `allow_null` and `allow_blank` arguments. The following set of arguments are used to control validation of empty values: * `required=False`: The value does not need to be present in the input, and will not be passed to `.create()` or `.update()` if it is not seen. * `default=<value>`: The value does not need to be present in the input, and a default value will be passed to `.create()` or `.update()` if it is not seen. -* `allow_none=True`: `None` is a valid input. +* `allow_null=True`: `None` is a valid input. * `allow_blank=True`: `''` is valid input. For `CharField` and subclasses only. -Typically you'll want to use `required=False` if the corresponding model field has a default value, and additionally set either `allow_none=True` or `allow_blank=True` if required. +Typically you'll want to use `required=False` if the corresponding model field has a default value, and additionally set either `allow_null=True` or `allow_blank=True` if required. The `default` argument is also available and always implies that the field is not required to be in the input. It is unnecessary to use the `required` argument when a default is specified, and doing so will result in an error. |
