From 8efe59233eb032acce2057ac73fa608b9cee449a Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 6 Aug 2025 18:57:24 +0100 Subject: [PATCH] Deployed de018df2 with MkDocs version: 1.6.0 --- api-guide/caching/index.html | 12 +- api-guide/exceptions/index.html | 2 +- api-guide/fields/index.html | 4 +- api-guide/filtering/index.html | 2 +- api-guide/generic-views/index.html | 2 +- api-guide/permissions/index.html | 2 +- api-guide/routers/index.html | 4 +- api-guide/schemas/index.html | 2 +- community/release-notes/index.html | 95 ++++++++---- community/third-party-packages/index.html | 2 +- search/search_index.json | 2 +- sitemap.xml | 140 +++++++++--------- sitemap.xml.gz | Bin 771 -> 771 bytes .../index.html | 10 ++ 14 files changed, 162 insertions(+), 117 deletions(-) diff --git a/api-guide/caching/index.html b/api-guide/caching/index.html index 714a307e6..7f762d86f 100644 --- a/api-guide/caching/index.html +++ b/api-guide/caching/index.html @@ -454,10 +454,10 @@ memory ... She remembered enough to work, and she worked hard. provided in Django.


Using cache with apiview and viewsets

-

Django provides a method_decorator to use +

Django provides a method_decorator to use decorators with class based views. This can be used with -other cache decorators such as cache_page, -vary_on_cookie and vary_on_headers.

+other cache decorators such as cache_page, +vary_on_cookie and vary_on_headers.

from django.utils.decorators import method_decorator
 from django.views.decorators.cache import cache_page
 from django.views.decorators.vary import vary_on_cookie, vary_on_headers
@@ -500,8 +500,8 @@ class PostView(APIView):
         return Response(content)
 

Using cache with @api_view decorator

-

When using @api_view decorator, the Django-provided method-based cache decorators such as cache_page, -vary_on_cookie and vary_on_headers can be called directly.

+

When using @api_view decorator, the Django-provided method-based cache decorators such as cache_page, +vary_on_cookie and vary_on_headers can be called directly.

from django.views.decorators.cache import cache_page
 from django.views.decorators.vary import vary_on_cookie
 
@@ -516,7 +516,7 @@ def get_user_list(request):
     content = {"user_feed": request.user.get_user_feed()}
     return Response(content)
 
-

NOTE: The cache_page decorator only caches the +

NOTE: The cache_page decorator only caches the GET and HEAD responses with status 200.

diff --git a/api-guide/exceptions/index.html b/api-guide/exceptions/index.html index 9d01412bc..e4b8631de 100644 --- a/api-guide/exceptions/index.html +++ b/api-guide/exceptions/index.html @@ -688,7 +688,7 @@ dictionary of items:

Django REST Framework provides two error views suitable for providing generic JSON 500 Server Error and 400 Bad Request responses. (Django's default error views provide HTML responses, which may not be appropriate for an API-only application.)

-

Use these as per Django's Customizing error views documentation.

+

Use these as per Django's Customizing error views documentation.

rest_framework.exceptions.server_error

Returns a response with status code 500 and application/json content type.

Set as handler500:

diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html index 8575506d9..1e351bbb1 100644 --- a/api-guide/fields/index.html +++ b/api-guide/fields/index.html @@ -668,7 +668,7 @@

Normally an error will be raised if a field is not supplied during deserialization. Set to false if this field is not required to be present during deserialization.

Setting this to False also allows the object attribute or dictionary key to be omitted from output when serializing the instance. If the key is not present it will simply not be included in the output representation.

-

Defaults to True. If you're using Model Serializer default value will be False if you have specified blank=True or default or null=True at your field in your Model.

+

Defaults to True. If you're using Model Serializer, the default value will be False when you have specified a default, or when the corresponding Model field has blank=True or null=True and is not part of a unique constraint at the same time. (Note that without a default value, unique constraints will cause the field to be required.)

default

If set, this gives the default value that will be used for the field if no input value is supplied. If not set the default behavior is to not populate the attribute at all.

The default is not applied during partial update operations. In the partial update case only fields that are provided in the incoming data will have a validated value returned.

@@ -696,7 +696,7 @@ Set to false if this field is not required to be present during deserialization.
class CommentSerializer(serializers.Serializer):
     email = serializers.EmailField(source="user.email")
 
-

This case would require user object to be fetched from database when it is not prefetched. If that is not wanted, be sure to be using prefetch_related and select_related methods appropriately. For more information about the methods refer to django documentation.

+

This case would require user object to be fetched from database when it is not prefetched. If that is not wanted, be sure to be using prefetch_related and select_related methods appropriately. For more information about the methods refer to django documentation.

The value source='*' has a special meaning, and is used to indicate that the entire object should be passed through to the field. This can be useful for creating nested representations, or for fields which require access to the complete object in order to determine the output representation.

Defaults to the name of the field.

validators

diff --git a/api-guide/filtering/index.html b/api-guide/filtering/index.html index fa74adea5..252de8757 100644 --- a/api-guide/filtering/index.html +++ b/api-guide/filtering/index.html @@ -689,7 +689,7 @@ class UserListView(generics.ListAPIView):

You can also perform a related lookup on a ForeignKey or ManyToManyField with the lookup API double-underscore notation:

search_fields = ['username', 'email', 'profile__profession']
 
-

For JSONField and HStoreField fields you can filter based on nested values within the data structure using the same double-underscore notation:

+

For JSONField and HStoreField fields you can filter based on nested values within the data structure using the same double-underscore notation:

search_fields = ['data__breed', 'data__owner__other_pets__0__name']
 

By default, searches will use case-insensitive partial matches. The search parameter may contain multiple search terms, which should be whitespace and/or comma separated. If multiple search terms are used then objects will be returned in the list only if all the provided terms are matched. Searches may contain quoted phrases with spaces, each phrase is considered as a single search term.

diff --git a/api-guide/generic-views/index.html b/api-guide/generic-views/index.html index 6b35d3a81..465cbc9aa 100644 --- a/api-guide/generic-views/index.html +++ b/api-guide/generic-views/index.html @@ -628,7 +628,7 @@ class UserList(generics.ListCreateAPIView): return user.accounts.all()
-

Note: If the serializer_class used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using select_related and prefetch_related. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in django documentation.

+

Note: If the serializer_class used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using select_related and prefetch_related. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in django documentation.


get_object(self)

Returns an object instance that should be used for detail views. Defaults to using the lookup_field parameter to filter the base queryset.

diff --git a/api-guide/permissions/index.html b/api-guide/permissions/index.html index 580533f9e..7249b5e8f 100644 --- a/api-guide/permissions/index.html +++ b/api-guide/permissions/index.html @@ -689,7 +689,7 @@ class ExampleView(APIView):

Note that DjangoObjectPermissions does not require the django-guardian package, and should support other object-level backends equally well.

As with DjangoModelPermissions you can use custom model permissions by overriding DjangoObjectPermissions and setting the .perms_map property. Refer to the source code for details.


-

Note: If you need object level view permissions for GET, HEAD and OPTIONS requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the DjangoObjectPermissionsFilter class provided by the djangorestframework-guardian2 package. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions.

+

Note: If you need object level view permissions for GET, HEAD and OPTIONS requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the DjangoObjectPermissionsFilter class provided by the djangorestframework-guardian package. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions.


Custom permissions

To implement a custom permission, override BasePermission and implement either, or both, of the following methods:

diff --git a/api-guide/routers/index.html b/api-guide/routers/index.html index 3a0bb3735..ff1b58314 100644 --- a/api-guide/routers/index.html +++ b/api-guide/routers/index.html @@ -566,7 +566,7 @@ urlpatterns += router.urls path('api/', include((router.urls, 'app_name'), namespace='instance_name')), ] -

See Django's URL namespaces docs and the include API reference for more details.

+

See Django's URL namespaces docs and the include API reference for more details.


Note: If using namespacing with hyperlinked serializers you'll also need to ensure that any view_name parameters on the serializers correctly reflect the namespace. In the examples above you'd need to include a parameter such as @@ -611,7 +611,7 @@ class UserViewSet(ModelViewSet):

  • URL name: 'user-change_password'
  • Using Django path() with routers

    -

    By default, the URLs created by routers use regular expressions. This behavior can be modified by setting the use_regex_path argument to False when instantiating the router, in this case path converters are used. For example:

    +

    By default, the URLs created by routers use regular expressions. This behavior can be modified by setting the use_regex_path argument to False when instantiating the router, in this case path converters are used. For example:

    router = SimpleRouter(use_regex_path=False)
     

    The router will match lookup values containing any characters except slashes and period characters. For a more restrictive (or lenient) lookup pattern, set the lookup_value_regex attribute on the viewset or lookup_value_converter if using path converters. For example, you can limit the lookup to valid UUIDs:

    diff --git a/api-guide/schemas/index.html b/api-guide/schemas/index.html index 2ceb7799f..9ced05dce 100644 --- a/api-guide/schemas/index.html +++ b/api-guide/schemas/index.html @@ -461,7 +461,7 @@

    Schema

    A machine-readable [schema] describes what resources are available via the API, what their URLs are, how they are represented and what operations they support.

    -

    — Heroku, JSON Schema for the Heroku Platform API

    +

    — Heroku, JSON Schema for the Heroku Platform API


    Deprecation notice:

    diff --git a/community/release-notes/index.html b/community/release-notes/index.html index c301b8a6f..4bf2581e2 100644 --- a/community/release-notes/index.html +++ b/community/release-notes/index.html @@ -437,30 +437,6 @@ 3.16.x series -
  • - Features -
  • - -
  • - Bug fixes -
  • - -
  • - Translations -
  • - -
  • - Removals -
  • - -
  • - Documentation and internal changes -
  • - -
  • - New Contributors -
  • -
  • 3.15.x series
  • @@ -578,17 +554,76 @@

    3.16.x series

    +

    3.16.1

    +

    Date: 6th August 2025

    +

    This release fixes a few bugs, clean-up some old code paths for unsupported Python versions and improve translations.

    +

    Minor changes

    + +

    Bug fixes

    + +

    Translations

    + +

    Documentation

    + +

    Internal changes

    + +

    New Contributors

    + +

    Full Changelog: https://github.com/encode/django-rest-framework/compare/3.16.0...3.16.1

    3.16.0

    Date: 28th March 2025

    This release is considered a significant release to improve upstream support with Django and Python. Some of these may change the behaviour of existing features and pre-existing behaviour. Specifically, some fixes were added to around the support of UniqueConstraint with nullable fields which will improve built-in serializer validation.

    -

    Features

    +

    Features

    -

    Bug fixes

    +

    Bug fixes

    -

    Translations

    +

    Translations

    -

    Removals

    +

    Removals

    -

    Documentation and internal changes

    +

    Documentation and internal changes

    -

    New Contributors

    +

    New Contributors

    Misc