Skip to content

Commit 7b8699a

Browse files
committed
Merge pull request #2167 from jpadilla/patch-1
Change allow_none to allow_null in 3.0 announcement
2 parents 555c450 + 080fa4f commit 7b8699a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/topics/3.0-announcement.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,22 +557,22 @@ We now use the following:
557557
* `Field` is the base class for all fields. It does not include any default implementation for either serializing or deserializing data.
558558
* `ReadOnlyField` is a concrete implementation for read-only fields that simply returns the attribute value without modification.
559559

560-
#### The `required`, `allow_none`, `allow_blank` and `default` arguments.
560+
#### The `required`, `allow_null`, `allow_blank` and `default` arguments.
561561

562562
REST framework now has more explicit and clear control over validating empty values for fields.
563563

564564
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.
565565

566-
We now have a better separation, with separate `required`, `allow_none` and `allow_blank` arguments.
566+
We now have a better separation, with separate `required`, `allow_null` and `allow_blank` arguments.
567567

568568
The following set of arguments are used to control validation of empty values:
569569

570570
* `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.
571571
* `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.
572-
* `allow_none=True`: `None` is a valid input.
572+
* `allow_null=True`: `None` is a valid input.
573573
* `allow_blank=True`: `''` is valid input. For `CharField` and subclasses only.
574574

575-
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.
575+
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.
576576

577577
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.
578578

0 commit comments

Comments
 (0)