diff --git a/404.html b/404.html index 7dd3f5fd2..677af73ac 100644 --- a/404.html +++ b/404.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/authentication/index.html b/api-guide/authentication/index.html index af64836ff..30f104718 100644 --- a/api-guide/authentication/index.html +++ b/api-guide/authentication/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/caching/index.html b/api-guide/caching/index.html index 6417edca9..8dd2e1189 100644 --- a/api-guide/caching/index.html +++ b/api-guide/caching/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/content-negotiation/index.html b/api-guide/content-negotiation/index.html index 3157ba3af..b09f6ed9a 100644 --- a/api-guide/content-negotiation/index.html +++ b/api-guide/content-negotiation/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/exceptions/index.html b/api-guide/exceptions/index.html index cc955e7a4..213fc1afe 100644 --- a/api-guide/exceptions/index.html +++ b/api-guide/exceptions/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html index a6aa67ced..acf810963 100644 --- a/api-guide/fields/index.html +++ b/api-guide/fields/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • @@ -836,7 +840,7 @@ explicitly declare the BooleanField on the serializer class, or use
  • min_value Validate that the number provided is no less than this value.
  • localize Set to True to enable localization of input and output based on the current locale. This will also force coerce_to_string to True. Defaults to False. Note that data formatting is enabled if you have set USE_L10N=True in your settings file.
  • rounding Sets the rounding mode used when quantizing to the configured precision. Valid values are decimal module rounding modes. Defaults to None.
  • -
  • normalize_output Will normalize the decimal value when serialized. This will strip all trailing zeroes and change the value's precision to the minimum required precision to be able to represent the value without loosing data. Defaults to False.
  • +
  • normalize_output Will normalize the decimal value when serialized. This will strip all trailing zeroes and change the value's precision to the minimum required precision to be able to represent the value without losing data. Defaults to False.
  • Example usage

    To validate numbers up to 999 with a resolution of 2 decimal places, you would use:

    diff --git a/api-guide/filtering/index.html b/api-guide/filtering/index.html index d831ba530..84d05e536 100644 --- a/api-guide/filtering/index.html +++ b/api-guide/filtering/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/format-suffixes/index.html b/api-guide/format-suffixes/index.html index 1841f3e66..5cc05c221 100644 --- a/api-guide/format-suffixes/index.html +++ b/api-guide/format-suffixes/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/generic-views/index.html b/api-guide/generic-views/index.html index f319152dd..4d1eaf3cb 100644 --- a/api-guide/generic-views/index.html +++ b/api-guide/generic-views/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/metadata/index.html b/api-guide/metadata/index.html index b78344c11..ca7352da8 100644 --- a/api-guide/metadata/index.html +++ b/api-guide/metadata/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/pagination/index.html b/api-guide/pagination/index.html index 89fde29fd..ee262e547 100644 --- a/api-guide/pagination/index.html +++ b/api-guide/pagination/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/parsers/index.html b/api-guide/parsers/index.html index 969eb0c10..0bdd67cd4 100644 --- a/api-guide/parsers/index.html +++ b/api-guide/parsers/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/permissions/index.html b/api-guide/permissions/index.html index 34cae0f5b..c9ab6ad65 100644 --- a/api-guide/permissions/index.html +++ b/api-guide/permissions/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/relations/index.html b/api-guide/relations/index.html index b4cd27a8a..00ee55a1a 100644 --- a/api-guide/relations/index.html +++ b/api-guide/relations/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/renderers/index.html b/api-guide/renderers/index.html index 10de41064..da751cd4c 100644 --- a/api-guide/renderers/index.html +++ b/api-guide/renderers/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/requests/index.html b/api-guide/requests/index.html index 405c1eef8..508312226 100644 --- a/api-guide/requests/index.html +++ b/api-guide/requests/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/responses/index.html b/api-guide/responses/index.html index cc4a1be22..d36f96b21 100644 --- a/api-guide/responses/index.html +++ b/api-guide/responses/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/reverse/index.html b/api-guide/reverse/index.html index 2d9a141d5..fd50c0923 100644 --- a/api-guide/reverse/index.html +++ b/api-guide/reverse/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/routers/index.html b/api-guide/routers/index.html index 7e91d6024..e05f9ddf1 100644 --- a/api-guide/routers/index.html +++ b/api-guide/routers/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/schemas/index.html b/api-guide/schemas/index.html index c05e8c3d5..91c5cb3ff 100644 --- a/api-guide/schemas/index.html +++ b/api-guide/schemas/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/serializers/index.html b/api-guide/serializers/index.html index 22962bf03..feb2cb58e 100644 --- a/api-guide/serializers/index.html +++ b/api-guide/serializers/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/settings/index.html b/api-guide/settings/index.html index f9757fe13..70dca17f6 100644 --- a/api-guide/settings/index.html +++ b/api-guide/settings/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/status-codes/index.html b/api-guide/status-codes/index.html index 841d9413b..b14bb8655 100644 --- a/api-guide/status-codes/index.html +++ b/api-guide/status-codes/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/testing/index.html b/api-guide/testing/index.html index 79c0cae2c..9c1ff0d0e 100644 --- a/api-guide/testing/index.html +++ b/api-guide/testing/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/throttling/index.html b/api-guide/throttling/index.html index 505dda129..f232d7fea 100644 --- a/api-guide/throttling/index.html +++ b/api-guide/throttling/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/validators/index.html b/api-guide/validators/index.html index ee069f620..dd8747274 100644 --- a/api-guide/validators/index.html +++ b/api-guide/validators/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • @@ -634,12 +638,9 @@ class ExampleSerializer(serializers.Serializer):

    Note: HiddenField() does not appear in partial=True serializer (when making PATCH request). This behavior might change in future, follow updates on github discussion.


    Advanced field defaults

    -

    Validators that are applied across multiple fields in the serializer can sometimes require a field input that should not be provided by the API client, but that is available as input to the validator.

    -

    Two patterns that you may want to use for this sort of validation include:

    - +

    Validators that are applied across multiple fields in the serializer can sometimes require a field input that should not be provided by the API client, but that is available as input to the validator. +For this purposes use HiddenField. This field will be present in validated_data but will not be used in the serializer output representation.

    +

    Note: Using a read_only=True field is excluded from writable fields so it won't use a default=… argument. Look 3.8 announcement.

    REST framework includes a couple of defaults that may be useful in this context.

    CurrentUserDefault

    A default class that can be used to represent the current user. In order to use this, the 'request' must have been provided as part of the context dictionary when instantiating the serializer.

    diff --git a/api-guide/versioning/index.html b/api-guide/versioning/index.html index 9eb914d39..c16755c71 100644 --- a/api-guide/versioning/index.html +++ b/api-guide/versioning/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/views/index.html b/api-guide/views/index.html index 018dff726..bf7684655 100644 --- a/api-guide/views/index.html +++ b/api-guide/views/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/api-guide/viewsets/index.html b/api-guide/viewsets/index.html index e7cc876b2..cf0b53015 100644 --- a/api-guide/viewsets/index.html +++ b/api-guide/viewsets/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • @@ -729,7 +733,7 @@ def delete_password(self, request, pk=None):

    You may need to provide custom ViewSet classes that do not have the full set of ModelViewSet actions, or that customize the behavior in some other way.

    Example

    To create a base viewset class that provides create, list and retrieve operations, inherit from GenericViewSet, and mixin the required actions:

    -
    from rest_framework import mixins
    +
    from rest_framework import mixins, viewsets
     
     class CreateListRetrieveViewSet(mixins.CreateModelMixin,
                                     mixins.ListModelMixin,
    diff --git a/community/3.0-announcement/index.html b/community/3.0-announcement/index.html
    index a789f487e..855017a17 100644
    --- a/community/3.0-announcement/index.html
    +++ b/community/3.0-announcement/index.html
    @@ -289,6 +289,10 @@
                         Release Notes
                       
                       
    +                  
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.1-announcement/index.html b/community/3.1-announcement/index.html index 701a752c7..e9e8f15b8 100644 --- a/community/3.1-announcement/index.html +++ b/community/3.1-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.10-announcement/index.html b/community/3.10-announcement/index.html index 4641cf0f7..643ee4e26 100644 --- a/community/3.10-announcement/index.html +++ b/community/3.10-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.11-announcement/index.html b/community/3.11-announcement/index.html index 148fbdd65..f2757c6ae 100644 --- a/community/3.11-announcement/index.html +++ b/community/3.11-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • @@ -499,7 +503,7 @@ be extracted from the class docstring:

  • Uniqueness validators need to be able to determine the name of the field to which they are applied, in order to run an appropriate database query.
  • The CurrentUserDefault needs to be able to determine the context with which the serializer was instantiated, in order to return the current user instance.
  • -

    Previous our approach to this was that implementations could include a set_context method, which would be called prior to validation. However this approach had issues with potential race conditions. We have now move this approach into a pending deprecation state. It will continue to function, but will be escalated to a deprecated state in 3.12, and removed entirely in 3.13.

    +

    Our previous approach to this was that implementations could include a set_context method, which would be called prior to validation. However this approach had issues with potential race conditions. We have now move this approach into a pending deprecation state. It will continue to function, but will be escalated to a deprecated state in 3.12, and removed entirely in 3.13.

    Instead, validators or defaults which require the serializer context, should include a requires_context = True attribute on the class.

    The __call__ method should then include an additional serializer_field argument.

    Validator implementations will look like this:

    diff --git a/community/3.12-announcement/index.html b/community/3.12-announcement/index.html index 4567444e5..58ab10a2f 100644 --- a/community/3.12-announcement/index.html +++ b/community/3.12-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.13-announcement/index.html b/community/3.13-announcement/index.html index a9b5bacb0..eb7aed93c 100644 --- a/community/3.13-announcement/index.html +++ b/community/3.13-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.14-announcement/index.html b/community/3.14-announcement/index.html index 7a5599461..9726740c5 100644 --- a/community/3.14-announcement/index.html +++ b/community/3.14-announcement/index.html @@ -57,7 +57,7 @@ - Search @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • @@ -418,7 +422,7 @@
  • - raise_exceptions argument for is_valid is now keyword-only. + raise_exception argument for is_valid is now keyword-only.
  • @@ -483,9 +487,9 @@
  • Python 3.6+
  • Django 4.1, 4.0, 3.2, 3.1, 3.0
  • -

    raise_exceptions argument for is_valid is now keyword-only.

    +

    raise_exception argument for is_valid is now keyword-only.

    Calling serializer_instance.is_valid(True) is no longer acceptable syntax. -If you'd like to use the raise_exceptions argument, you must use it as a +If you'd like to use the raise_exception argument, you must use it as a keyword argument.

    See Pull Request #7952 for more details.

    ManyRelatedField supports returning the default when the source attribute doesn't exist.

    diff --git a/community/3.15-announcement/index.html b/community/3.15-announcement/index.html new file mode 100644 index 000000000..b84e062c6 --- /dev/null +++ b/community/3.15-announcement/index.html @@ -0,0 +1,557 @@ + + + + + + + 3.15 Announcement - Django REST framework + + + + + + + + + + + + + + + + + + + +
    + + +
    +
    + + + +
    + + +
    + + + + + +

    Django REST framework 3.15

    +

    At the Internet, on March 15th, 2024, with 176 commits by 138 authors, we are happy to announce the release of Django REST framework 3.15.

    +

    Django 5.0 and Python 3.12 support

    +

    The latest release now fully supports Django 5.0 and Python 3.12.

    +

    The current minimum versions of Django still is 3.0 and Python 3.6.

    +

    Primary Support of UniqueConstraint

    +

    ModelSerializer generates validators for UniqueConstraint (both UniqueValidator and UniqueTogetherValidator)

    +

    ValidationErrors improvements

    +

    The ValidationError has been aligned with Django's, currently supporting the same style (signature) and nesting.

    +

    SimpleRouter non-regex matching support

    +

    By default the URLs created by SimpleRouter use regular expressions. This behavior can be modified by setting the use_regex_path argument to False when instantiating the router.

    +

    ZoneInfo as the primary source of timezone data

    +

    Dependency on pytz has been removed and deprecation warnings have been added, Django will provide ZoneInfo instances as long as USE_DEPRECATED_PYTZ is not enabled. More info on the migration can be found in this guide.

    + +

    Searches now may contain quoted phrases with spaces, each phrase is considered as a single search term, and it will raise a validation error if any null-character is provided in search. See the Filtering API guide for more information.

    +

    Default values propagation

    +

    Model fields' default values are now propagated to serializer fields, for more information see the Serializer fields API guide.

    +

    Other fixes and improvements

    +

    There are a number of fixes and minor improvements in this release, ranging from documentation, internal infrastructure (typing, testing, requirements, deprecation, etc.), security and overall behaviour.

    +

    See the release notes page for a complete listing.

    + + +
    +
    +
    +
    +
    +
    + +
    +

    Documentation built with MkDocs. +

    +
    + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/community/3.2-announcement/index.html b/community/3.2-announcement/index.html index 20857edcb..890081339 100644 --- a/community/3.2-announcement/index.html +++ b/community/3.2-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.3-announcement/index.html b/community/3.3-announcement/index.html index 175ced8e8..f8869015b 100644 --- a/community/3.3-announcement/index.html +++ b/community/3.3-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.4-announcement/index.html b/community/3.4-announcement/index.html index 6f625bcd0..41ea183ea 100644 --- a/community/3.4-announcement/index.html +++ b/community/3.4-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.5-announcement/index.html b/community/3.5-announcement/index.html index e43de8cae..92d422933 100644 --- a/community/3.5-announcement/index.html +++ b/community/3.5-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • @@ -523,14 +527,10 @@ you to use the schema d from rest_framework_swagger.renderers import OpenAPIRenderer, SwaggerUIRenderer schema_view = get_schema_view( - title='Example API', - renderer_classes=[OpenAPIRenderer, SwaggerUIRenderer] + title="Example API", renderer_classes=[OpenAPIRenderer, SwaggerUIRenderer] ) -urlpatterns = [ - path('swagger/', schema_view), - ... -] +urlpatterns = [path("swagger/", schema_view), ...]

    There have been a large number of fixes to the schema generation. These should resolve issues for anyone using the latest version of the django-rest-swagger diff --git a/community/3.6-announcement/index.html b/community/3.6-announcement/index.html index 45eb2795c..b4f13e0c3 100644 --- a/community/3.6-announcement/index.html +++ b/community/3.6-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +

  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.7-announcement/index.html b/community/3.7-announcement/index.html index bf0ec1076..6c8fba6b3 100644 --- a/community/3.7-announcement/index.html +++ b/community/3.7-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.8-announcement/index.html b/community/3.8-announcement/index.html index 013b60f43..83407f4a5 100644 --- a/community/3.8-announcement/index.html +++ b/community/3.8-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/3.9-announcement/index.html b/community/3.9-announcement/index.html index 933b08e60..d7491029c 100644 --- a/community/3.9-announcement/index.html +++ b/community/3.9-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/contributing/index.html b/community/contributing/index.html index 8d8b7e479..0784f81c2 100644 --- a/community/contributing/index.html +++ b/community/contributing/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/funding/index.html b/community/funding/index.html index 6a7b2df16..d560f31ed 100644 --- a/community/funding/index.html +++ b/community/funding/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/jobs/index.html b/community/jobs/index.html index b0aca83cf..d262c320a 100644 --- a/community/jobs/index.html +++ b/community/jobs/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/kickstarter-announcement/index.html b/community/kickstarter-announcement/index.html index 04f3c423b..613349d38 100644 --- a/community/kickstarter-announcement/index.html +++ b/community/kickstarter-announcement/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/mozilla-grant/index.html b/community/mozilla-grant/index.html index 797098944..02f824ac1 100644 --- a/community/mozilla-grant/index.html +++ b/community/mozilla-grant/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/project-management/index.html b/community/project-management/index.html index fd802f24d..0380e05c3 100644 --- a/community/project-management/index.html +++ b/community/project-management/index.html @@ -289,6 +289,10 @@ Release Notes +
  • + 3.15 Announcement +
  • +
  • 3.14 Announcement
  • diff --git a/community/release-notes/index.html b/community/release-notes/index.html index b2aba3c24..3f95891b6 100644 --- a/community/release-notes/index.html +++ b/community/release-notes/index.html @@ -54,7 +54,7 @@

    Because we're using viewsets instead of views, we can automatically generate the URL conf for our API, by simply registering the viewsets with a router class.

    Again, if we need more control over the API URLs we can simply drop down to using regular class-based views, and writing the URL conf explicitly.