From 442f49eb5b8bfe6aebd599191482e2ffc532d87c Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 1 Dec 2014 15:37:23 +0000 Subject: [PATCH] Update documentation --- topics/3.0-announcement/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/topics/3.0-announcement/index.html b/topics/3.0-announcement/index.html index 40d86e38c..0071c4361 100644 --- a/topics/3.0-announcement/index.html +++ b/topics/3.0-announcement/index.html @@ -850,18 +850,18 @@ def all_high_scores(request):
  • 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:

    -

    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.

    Coercing output types.

    The previous field implementations did not forcibly coerce returned values into the correct type in many cases. For example, an IntegerField would return a string output if the attribute value was a string. We now more strictly coerce to the correct return type, leading to more constrained and expected behavior.