You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/topics/3.0-announcement.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -557,22 +557,22 @@ We now use the following:
557
557
*`Field` is the base class for all fields. It does not include any default implementation for either serializing or deserializing data.
558
558
*`ReadOnlyField` is a concrete implementation for read-only fields that simply returns the attribute value without modification.
559
559
560
-
#### The `required`, `allow_none`, `allow_blank` and `default` arguments.
560
+
#### The `required`, `allow_null`, `allow_blank` and `default` arguments.
561
561
562
562
REST framework now has more explicit and clear control over validating empty values for fields.
563
563
564
564
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.
565
565
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.
567
567
568
568
The following set of arguments are used to control validation of empty values:
569
569
570
570
*`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.
571
571
*`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.
573
573
*`allow_blank=True`: `''` is valid input. For `CharField` and subclasses only.
574
574
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.
576
576
577
577
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.
0 commit comments