From 469ca95e6bee171f4f87e30a83ebcde7b4bed3a7 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 8 Dec 2021 15:12:21 +0000 Subject: [PATCH] Deployed c05998f5 with MkDocs version: 1.1.2 --- api-guide/fields/index.html | 9 +- api-guide/filtering/index.html | 2 +- api-guide/generic-views/index.html | 3 + api-guide/pagination/index.html | 2 +- api-guide/permissions/index.html | 6 +- api-guide/relations/index.html | 25 ++++ api-guide/serializers/index.html | 16 ++- api-guide/testing/index.html | 4 +- api-guide/views/index.html | 1 + api-guide/viewsets/index.html | 2 +- community/3.9-announcement/index.html | 2 +- community/third-party-packages/index.html | 1 + .../7-schemas-and-client-libraries/index.html | 8 ++ coreapi/from-documenting-your-api/index.html | 8 ++ coreapi/index.html | 4 +- coreapi/schemas/index.html | 4 + img/premium/cryptapi-readme.png | Bin 0 -> 17864 bytes img/premium/posthog-readme.png | Bin 0 -> 2402 bytes index.html | 4 +- search/main.js | 4 +- search/search_index.json | 2 +- search/worker.js | 2 + sitemap.xml | 132 +++++++++--------- sitemap.xml.gz | Bin 754 -> 753 bytes topics/ajax-csrf-cors/index.html | 2 +- .../index.html | 2 +- tutorial/quickstart/index.html | 2 +- 27 files changed, 160 insertions(+), 87 deletions(-) create mode 100644 img/premium/cryptapi-readme.png create mode 100644 img/premium/posthog-readme.png diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html index 29431d95c..f2d68555d 100644 --- a/api-guide/fields/index.html +++ b/api-guide/fields/index.html @@ -683,7 +683,12 @@ Set to false if this field is not required to be present during deserialization.

Note that, without an explicit default, setting this argument to True will imply a default value of null for serialization output, but does not imply a default for input deserialization.

Defaults to False

source

-

The name of the attribute that will be used to populate the field. May be a method that only takes a self argument, such as URLField(source='get_absolute_url'), or may use dotted notation to traverse attributes, such as EmailField(source='user.email'). When serializing fields with dotted notation, it may be necessary to provide a default value if any object is not present or is empty during attribute traversal.

+

The name of the attribute that will be used to populate the field. May be a method that only takes a self argument, such as URLField(source='get_absolute_url'), or may use dotted notation to traverse attributes, such as EmailField(source='user.email').

+

When serializing fields with dotted notation, it may be necessary to provide a default value if any object is not present or is empty during attribute traversal. Beware of possible n+1 problems when using source attribute if you are accessing a relational orm model. For example:

+
class CommentSerializer(serializers.Serializer):
+    email = serializers.EmailField(source="user.email")
+
+

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

@@ -850,7 +855,7 @@ explicitly declare the BooleanField on the serializer class, or use

DateTimeField format strings.

Format strings may either be Python strftime formats which explicitly specify the format, or the special string 'iso-8601', which indicates that ISO 8601 style datetimes should be used. (eg '2013-01-29T12:34:56.000000Z')

diff --git a/api-guide/filtering/index.html b/api-guide/filtering/index.html index a1c18461b..ed6840e3b 100644 --- a/api-guide/filtering/index.html +++ b/api-guide/filtering/index.html @@ -703,7 +703,7 @@ class CustomSearchFilter(filters.SearchFilter): def get_search_fields(self, view, request): if request.query_params.get('title_only'): return ['title'] - return super(CustomSearchFilter, self).get_search_fields(view, request) + return super().get_search_fields(view, request)

For more details, see the Django documentation.


diff --git a/api-guide/generic-views/index.html b/api-guide/generic-views/index.html index 3ebf05571..d6b08991d 100644 --- a/api-guide/generic-views/index.html +++ b/api-guide/generic-views/index.html @@ -615,6 +615,9 @@ class UserList(generics.ListCreateAPIView): user = self.request.user 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.

+

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.

May be overridden to provide more complex behavior, such as object lookups based on more than one URL kwarg.

diff --git a/api-guide/pagination/index.html b/api-guide/pagination/index.html index b6324a532..2cac0c0a1 100644 --- a/api-guide/pagination/index.html +++ b/api-guide/pagination/index.html @@ -729,7 +729,7 @@ that REST framework provides, by implementing a get_schema_fields()

drf-proxy-pagination

The drf-proxy-pagination package includes a ProxyPagination class which allows to choose pagination class with a query parameter.

-

The django-rest-framework-link-header-pagination package includes a LinkHeaderPagination class which provides pagination via an HTTP Link header as described in Github's developer documentation.

+

The django-rest-framework-link-header-pagination package includes a LinkHeaderPagination class which provides pagination via an HTTP Link header as described in GitHub REST API documentation.

diff --git a/api-guide/permissions/index.html b/api-guide/permissions/index.html index a2d23bdc3..ae4d03af0 100644 --- a/api-guide/permissions/index.html +++ b/api-guide/permissions/index.html @@ -543,8 +543,8 @@

How permissions are determined

Permissions in REST framework are always defined as a list of permission classes.

Before running the main body of the view each permission in the list is checked. -If any permission check fails an exceptions.PermissionDenied or exceptions.NotAuthenticated exception will be raised, and the main body of the view will not run.

-

When the permissions checks fail either a "403 Forbidden" or a "401 Unauthorized" response will be returned, according to the following rules:

+If any permission check fails, an exceptions.PermissionDenied or exceptions.NotAuthenticated exception will be raised, and the main body of the view will not run.

+

When the permission checks fail, either a "403 Forbidden" or a "401 Unauthorized" response will be returned, according to the following rules: