mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 22:04:48 +03:00
Deployed de018df2
with MkDocs version: 1.6.0
This commit is contained in:
parent
7b9d3ec3de
commit
8efe59233e
|
@ -454,10 +454,10 @@ memory ... She remembered enough to work, and she worked hard.
|
|||
provided in Django.</p>
|
||||
<hr />
|
||||
<h2 id="using-cache-with-apiview-and-viewsets"><a class="toclink" href="#using-cache-with-apiview-and-viewsets">Using cache with apiview and viewsets</a></h2>
|
||||
<p>Django provides a <a href="https://docs.djangoproject.com/en/dev/topics/class-based-views/intro/#decorating-the-class"><code>method_decorator</code></a> to use
|
||||
<p>Django provides a <a href="https://docs.djangoproject.com/en/stable/topics/class-based-views/intro/#decorating-the-class"><code>method_decorator</code></a> to use
|
||||
decorators with class based views. This can be used with
|
||||
other cache decorators such as <a href="https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache"><code>cache_page</code></a>,
|
||||
<a href="https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie"><code>vary_on_cookie</code></a> and <a href="https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_headers"><code>vary_on_headers</code></a>.</p>
|
||||
other cache decorators such as <a href="https://docs.djangoproject.com/en/stable/topics/cache/#the-per-view-cache"><code>cache_page</code></a>,
|
||||
<a href="https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie"><code>vary_on_cookie</code></a> and <a href="https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_headers"><code>vary_on_headers</code></a>.</p>
|
||||
<pre><code class="language-python">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)
|
||||
</code></pre>
|
||||
<h2 id="using-cache-with-api_view-decorator"><a class="toclink" href="#using-cache-with-api_view-decorator">Using cache with @api_view decorator</a></h2>
|
||||
<p>When using @api_view decorator, the Django-provided method-based cache decorators such as <a href="https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache"><code>cache_page</code></a>,
|
||||
<a href="https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie"><code>vary_on_cookie</code></a> and <a href="https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_headers"><code>vary_on_headers</code></a> can be called directly.</p>
|
||||
<p>When using @api_view decorator, the Django-provided method-based cache decorators such as <a href="https://docs.djangoproject.com/en/stable/topics/cache/#the-per-view-cache"><code>cache_page</code></a>,
|
||||
<a href="https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie"><code>vary_on_cookie</code></a> and <a href="https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_headers"><code>vary_on_headers</code></a> can be called directly.</p>
|
||||
<pre><code class="language-python">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)
|
||||
</code></pre>
|
||||
<p><strong>NOTE:</strong> The <a href="https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache"><code>cache_page</code></a> decorator only caches the
|
||||
<p><strong>NOTE:</strong> The <a href="https://docs.djangoproject.com/en/stable/topics/cache/#the-per-view-cache"><code>cache_page</code></a> decorator only caches the
|
||||
<code>GET</code> and <code>HEAD</code> responses with status 200.</p>
|
||||
|
||||
|
||||
|
|
|
@ -688,7 +688,7 @@ dictionary of items:</p>
|
|||
<p>Django REST Framework provides two error views suitable for providing generic JSON <code>500</code> Server Error and
|
||||
<code>400</code> Bad Request responses. (Django's default error views provide HTML responses, which may not be appropriate for an
|
||||
API-only application.)</p>
|
||||
<p>Use these as per <a href="https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views">Django's Customizing error views documentation</a>.</p>
|
||||
<p>Use these as per <a href="https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-error-views">Django's Customizing error views documentation</a>.</p>
|
||||
<h2 id="rest_frameworkexceptionsserver_error"><a class="toclink" href="#rest_frameworkexceptionsserver_error"><code>rest_framework.exceptions.server_error</code></a></h2>
|
||||
<p>Returns a response with status code <code>500</code> and <code>application/json</code> content type.</p>
|
||||
<p>Set as <code>handler500</code>:</p>
|
||||
|
|
|
@ -668,7 +668,7 @@
|
|||
<p>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.</p>
|
||||
<p>Setting this to <code>False</code> 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.</p>
|
||||
<p>Defaults to <code>True</code>. If you're using <a href="https://www.django-rest-framework.org/api-guide/serializers/#modelserializer">Model Serializer</a> default value will be <code>False</code> if you have specified <code>blank=True</code> or <code>default</code> or <code>null=True</code> at your field in your <code>Model</code>.</p>
|
||||
<p>Defaults to <code>True</code>. If you're using <a href="https://www.django-rest-framework.org/api-guide/serializers/#modelserializer">Model Serializer</a>, the default value will be <code>False</code> when you have specified a <code>default</code>, or when the corresponding <code>Model</code> field has <code>blank=True</code> or <code>null=True</code> and is not part of a unique constraint at the same time. (Note that without a <code>default</code> value, <a href="https://www.django-rest-framework.org/api-guide/validators/#optional-fields">unique constraints will cause the field to be required</a>.)</p>
|
||||
<h3 id="default"><a class="toclink" href="#default"><code>default</code></a></h3>
|
||||
<p>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.</p>
|
||||
<p>The <code>default</code> 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.</p>
|
||||
|
@ -696,7 +696,7 @@ Set to false if this field is not required to be present during deserialization.
|
|||
<pre><code>class CommentSerializer(serializers.Serializer):
|
||||
email = serializers.EmailField(source="user.email")
|
||||
</code></pre>
|
||||
<p>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 <code>prefetch_related</code> and <code>select_related</code> methods appropriately. For more information about the methods refer to <a href="https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related">django documentation</a>.</p>
|
||||
<p>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 <code>prefetch_related</code> and <code>select_related</code> methods appropriately. For more information about the methods refer to <a href="https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_related">django documentation</a>.</p>
|
||||
<p>The value <code>source='*'</code> 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.</p>
|
||||
<p>Defaults to the name of the field.</p>
|
||||
<h3 id="validators"><a class="toclink" href="#validators"><code>validators</code></a></h3>
|
||||
|
|
|
@ -689,7 +689,7 @@ class UserListView(generics.ListAPIView):
|
|||
<p>You can also perform a related lookup on a ForeignKey or ManyToManyField with the lookup API double-underscore notation:</p>
|
||||
<pre><code>search_fields = ['username', 'email', 'profile__profession']
|
||||
</code></pre>
|
||||
<p>For <a href="https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#jsonfield">JSONField</a> and <a href="https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#hstorefield">HStoreField</a> fields you can filter based on nested values within the data structure using the same double-underscore notation:</p>
|
||||
<p>For <a href="https://docs.djangoproject.com/en/stable/ref/models/fields/#django.db.models.JSONField">JSONField</a> and <a href="https://docs.djangoproject.com/en/stable/ref/contrib/postgres/fields/#hstorefield">HStoreField</a> fields you can filter based on nested values within the data structure using the same double-underscore notation:</p>
|
||||
<pre><code>search_fields = ['data__breed', 'data__owner__other_pets__0__name']
|
||||
</code></pre>
|
||||
<p>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 <em>quoted phrases</em> with spaces, each phrase is considered as a single search term.</p>
|
||||
|
|
|
@ -628,7 +628,7 @@ class UserList(generics.ListCreateAPIView):
|
|||
return user.accounts.all()
|
||||
</code></pre>
|
||||
<hr />
|
||||
<p><strong>Note:</strong> If the <code>serializer_class</code> used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using <code>select_related</code> and <code>prefetch_related</code>. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in <a href="https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related">django documentation</a>.</p>
|
||||
<p><strong>Note:</strong> If the <code>serializer_class</code> used in the generic view spans orm relations, leading to an n+1 problem, you could optimize your queryset in this method using <code>select_related</code> and <code>prefetch_related</code>. To get more information about n+1 problem and use cases of the mentioned methods refer to related section in <a href="https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_related">django documentation</a>.</p>
|
||||
<hr />
|
||||
<h4 id="get_objectself"><a class="toclink" href="#get_objectself"><code>get_object(self)</code></a></h4>
|
||||
<p>Returns an object instance that should be used for detail views. Defaults to using the <code>lookup_field</code> parameter to filter the base queryset.</p>
|
||||
|
|
|
@ -689,7 +689,7 @@ class ExampleView(APIView):
|
|||
<p>Note that <code>DjangoObjectPermissions</code> <strong>does not</strong> require the <code>django-guardian</code> package, and should support other object-level backends equally well.</p>
|
||||
<p>As with <code>DjangoModelPermissions</code> you can use custom model permissions by overriding <code>DjangoObjectPermissions</code> and setting the <code>.perms_map</code> property. Refer to the source code for details.</p>
|
||||
<hr />
|
||||
<p><strong>Note</strong>: If you need object level <code>view</code> permissions for <code>GET</code>, <code>HEAD</code> and <code>OPTIONS</code> requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the <code>DjangoObjectPermissionsFilter</code> class provided by the <a href="https://github.com/johnthagen/django-rest-framework-guardian2"><code>djangorestframework-guardian2</code> package</a>. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions.</p>
|
||||
<p><strong>Note</strong>: If you need object level <code>view</code> permissions for <code>GET</code>, <code>HEAD</code> and <code>OPTIONS</code> requests and are using django-guardian for your object-level permissions backend, you'll want to consider using the <code>DjangoObjectPermissionsFilter</code> class provided by the <a href="https://github.com/rpkilby/django-rest-framework-guardian"><code>djangorestframework-guardian</code> package</a>. It ensures that list endpoints only return results including objects for which the user has appropriate view permissions.</p>
|
||||
<hr />
|
||||
<h1 id="custom-permissions"><a class="toclink" href="#custom-permissions">Custom permissions</a></h1>
|
||||
<p>To implement a custom permission, override <code>BasePermission</code> and implement either, or both, of the following methods:</p>
|
||||
|
|
|
@ -566,7 +566,7 @@ urlpatterns += router.urls
|
|||
path('api/', include((router.urls, 'app_name'), namespace='instance_name')),
|
||||
]
|
||||
</code></pre>
|
||||
<p>See Django's <a href="https://docs.djangoproject.com/en/4.0/topics/http/urls/#url-namespaces">URL namespaces docs</a> and the <a href="https://docs.djangoproject.com/en/4.0/ref/urls/#include"><code>include</code> API reference</a> for more details.</p>
|
||||
<p>See Django's <a href="https://docs.djangoproject.com/en/stable/topics/http/urls/#url-namespaces">URL namespaces docs</a> and the <a href="https://docs.djangoproject.com/en/stable/ref/urls/#include"><code>include</code> API reference</a> for more details.</p>
|
||||
<hr />
|
||||
<p><strong>Note</strong>: If using namespacing with hyperlinked serializers you'll also need to ensure that any <code>view_name</code> 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):
|
|||
<li>URL name: <code>'user-change_password'</code></li>
|
||||
</ul>
|
||||
<h3 id="using-django-path-with-routers"><a class="toclink" href="#using-django-path-with-routers">Using Django <code>path()</code> with routers</a></h3>
|
||||
<p>By default, the URLs created by routers use regular expressions. This behavior can be modified by setting the <code>use_regex_path</code> argument to <code>False</code> when instantiating the router, in this case <a href="https://docs.djangoproject.com/en/2.0/topics/http/urls/#path-converters">path converters</a> are used. For example:</p>
|
||||
<p>By default, the URLs created by routers use regular expressions. This behavior can be modified by setting the <code>use_regex_path</code> argument to <code>False</code> when instantiating the router, in this case <a href="https://docs.djangoproject.com/en/stable/topics/http/urls/#path-converters">path converters</a> are used. For example:</p>
|
||||
<pre><code>router = SimpleRouter(use_regex_path=False)
|
||||
</code></pre>
|
||||
<p>The router will match lookup values containing any characters except slashes and period characters. For a more restrictive (or lenient) lookup pattern, set the <code>lookup_value_regex</code> attribute on the viewset or <code>lookup_value_converter</code> if using path converters. For example, you can limit the lookup to valid UUIDs:</p>
|
||||
|
|
|
@ -461,7 +461,7 @@
|
|||
<h1 id="schema"><a class="toclink" href="#schema">Schema</a></h1>
|
||||
<blockquote>
|
||||
<p>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.</p>
|
||||
<p>— Heroku, <a href="https://blog.heroku.com/archives/2014/1/8/json_schema_for_heroku_platform_api">JSON Schema for the Heroku Platform API</a></p>
|
||||
<p>— Heroku, <a href="https://www.heroku.com/blog/json_schema_for_heroku_platform_api/">JSON Schema for the Heroku Platform API</a></p>
|
||||
</blockquote>
|
||||
<hr />
|
||||
<p><strong>Deprecation notice:</strong></p>
|
||||
|
|
|
@ -437,30 +437,6 @@
|
|||
<a href="#316x-series">3.16.x series</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#features">Features</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#bug-fixes">Bug fixes</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#translations">Translations</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#removals">Removals</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#documentation-and-internal-changes">Documentation and internal changes</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#new-contributors">New Contributors</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#315x-series">3.15.x series</a>
|
||||
</li>
|
||||
|
@ -578,17 +554,76 @@
|
|||
</code></pre>
|
||||
<hr />
|
||||
<h2 id="316x-series"><a class="toclink" href="#316x-series">3.16.x series</a></h2>
|
||||
<h3 id="3161"><a class="toclink" href="#3161">3.16.1</a></h3>
|
||||
<p><strong>Date</strong>: 6th August 2025</p>
|
||||
<p>This release fixes a few bugs, clean-up some old code paths for unsupported Python versions and improve translations.</p>
|
||||
<h4 id="minor-changes"><a class="toclink" href="#minor-changes">Minor changes</a></h4>
|
||||
<ul>
|
||||
<li>Cleanup optional <code>backports.zoneinfo</code> dependency and conditions on unsupported Python 3.8 and lower in <a href="https://github.com/encode/django-rest-framework/pull/9681">#9681</a>. Python versions prior to 3.9 were already unsupported so this shouldn't be a breaking change.</li>
|
||||
</ul>
|
||||
<h4 id="bug-fixes"><a class="toclink" href="#bug-fixes">Bug fixes</a></h4>
|
||||
<ul>
|
||||
<li>Fix regression in <code>unique_together</code> validation with <code>SerializerMethodField</code> in <a href="https://github.com/encode/django-rest-framework/pull/9712">#9712</a></li>
|
||||
<li>Fix <code>UniqueTogetherValidator</code> to handle fields with <code>source</code> attribute in <a href="https://github.com/encode/django-rest-framework/pull/9688">#9688</a></li>
|
||||
<li>Drop HTML line breaks on long headers in browsable API in <a href="https://github.com/encode/django-rest-framework/pull/9438">#9438</a></li>
|
||||
</ul>
|
||||
<h4 id="translations"><a class="toclink" href="#translations">Translations</a></h4>
|
||||
<ul>
|
||||
<li>Add Kazakh locale support in <a href="https://github.com/encode/django-rest-framework/pull/9713">#9713</a></li>
|
||||
<li>Update translations for Korean translations in <a href="https://github.com/encode/django-rest-framework/pull/9571">#9571</a></li>
|
||||
<li>Update German translations in <a href="https://github.com/encode/django-rest-framework/pull/9676">#9676</a></li>
|
||||
<li>Update Chinese translations in <a href="https://github.com/encode/django-rest-framework/pull/9675">#9675</a></li>
|
||||
<li>Update Arabic translations-sal in <a href="https://github.com/encode/django-rest-framework/pull/9595">#9595</a></li>
|
||||
<li>Update Persian translations in <a href="https://github.com/encode/django-rest-framework/pull/9576">#9576</a></li>
|
||||
<li>Update Spanish translations in <a href="https://github.com/encode/django-rest-framework/pull/9701">#9701</a></li>
|
||||
<li>Update Turkish Translations in <a href="https://github.com/encode/django-rest-framework/pull/9749">#9749</a></li>
|
||||
<li>Fix some typos in Brazilian Portuguese translations in <a href="https://github.com/encode/django-rest-framework/pull/9673">#9673</a></li>
|
||||
</ul>
|
||||
<h4 id="documentation"><a class="toclink" href="#documentation">Documentation</a></h4>
|
||||
<ul>
|
||||
<li>Removed reference to GitHub Issues and Discussions in <a href="https://github.com/encode/django-rest-framework/pull/9660">#9660</a></li>
|
||||
<li>Add <code>drf-restwind</code> and update outdated images in <code>browsable-api.md</code> in <a href="https://github.com/encode/django-rest-framework/pull/9680">#9680</a></li>
|
||||
<li>Updated funding page to represent current scope in <a href="https://github.com/encode/django-rest-framework/pull/9686">#9686</a></li>
|
||||
<li>Fix broken Heroku JSON Schema link in <a href="https://github.com/encode/django-rest-framework/pull/9693">#9693</a></li>
|
||||
<li>Update Django documentation links to use stable version in <a href="https://github.com/encode/django-rest-framework/pull/9698">#9698</a></li>
|
||||
<li>Expand docs on unique constraints cause 'required=True' in <a href="https://github.com/encode/django-rest-framework/pull/9725">#9725</a></li>
|
||||
<li>Revert extension back from <code>djangorestframework-guardian2</code> to <code>djangorestframework-guardian</code> in <a href="https://github.com/encode/django-rest-framework/pull/9734">#9734</a></li>
|
||||
<li>Add note to tutorial about required <code>request</code> in serializer context when using <code>HyperlinkedModelSerializer</code> in <a href="https://github.com/encode/django-rest-framework/pull/9732">#9732</a></li>
|
||||
</ul>
|
||||
<h4 id="internal-changes"><a class="toclink" href="#internal-changes">Internal changes</a></h4>
|
||||
<ul>
|
||||
<li>Update GitHub Actions to use Ubuntu 24.04 for testing in <a href="https://github.com/encode/django-rest-framework/pull/9677">#9677</a></li>
|
||||
<li>Update test matrix to use Django 5.2 stable version in <a href="https://github.com/encode/django-rest-framework/pull/9679">#9679</a></li>
|
||||
<li>Add <code>pyupgrade</code> to <code>pre-commit</code> hooks in <a href="https://github.com/encode/django-rest-framework/pull/9682">#9682</a></li>
|
||||
<li>Fix test with Django 5 when <code>pytz</code> is available in <a href="https://github.com/encode/django-rest-framework/pull/9715">#9715</a></li>
|
||||
</ul>
|
||||
<h4 id="new-contributors"><a class="toclink" href="#new-contributors">New Contributors</a></h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/araggohnxd"><code>@araggohnxd</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9673">#9673</a></li>
|
||||
<li><a href="https://github.com/mbeijen"><code>@mbeijen</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9660">#9660</a></li>
|
||||
<li><a href="https://github.com/stefan6419846"><code>@stefan6419846</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9676">#9676</a></li>
|
||||
<li><a href="https://github.com/ren000thomas"><code>@ren000thomas</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9675">#9675</a></li>
|
||||
<li><a href="https://github.com/ulgens"><code>@ulgens</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9682">#9682</a></li>
|
||||
<li><a href="https://github.com/bukh-sal"><code>@bukh-sal</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9595">#9595</a></li>
|
||||
<li><a href="https://github.com/rezatn0934"><code>@rezatn0934</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9576">#9576</a></li>
|
||||
<li><a href="https://github.com/Rohit10jr"><code>@Rohit10jr</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9693">#9693</a></li>
|
||||
<li><a href="https://github.com/kushibayev"><code>@kushibayev</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9713">#9713</a></li>
|
||||
<li><a href="https://github.com/alihassancods"><code>@alihassancods</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9732">#9732</a></li>
|
||||
<li><a href="https://github.com/kulikjak"><code>@kulikjak</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9715">#9715</a></li>
|
||||
<li><a href="https://github.com/Natgho"><code>@Natgho</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9749">#9749</a></li>
|
||||
</ul>
|
||||
<p><strong>Full Changelog</strong>: https://github.com/encode/django-rest-framework/compare/3.16.0...3.16.1</p>
|
||||
<h3 id="3160"><a class="toclink" href="#3160">3.16.0</a></h3>
|
||||
<p><strong>Date</strong>: 28th March 2025</p>
|
||||
<p>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 <code>UniqueConstraint</code> with nullable fields which will improve built-in serializer validation.</p>
|
||||
<h2 id="features"><a class="toclink" href="#features">Features</a></h2>
|
||||
<h4 id="features"><a class="toclink" href="#features">Features</a></h4>
|
||||
<ul>
|
||||
<li>Add official support for Django 5.1 and its new <code>LoginRequiredMiddleware</code> in <a href="https://github.com/encode/django-rest-framework/pull/9514">#9514</a> and <a href="https://github.com/encode/django-rest-framework/pull/9657">#9657</a></li>
|
||||
<li>Add official Django 5.2a1 support in <a href="https://github.com/encode/django-rest-framework/pull/9634">#9634</a></li>
|
||||
<li>Add support for Python 3.13 in <a href="https://github.com/encode/django-rest-framework/pull/9527">#9527</a> and <a href="https://github.com/encode/django-rest-framework/pull/9556">#9556</a></li>
|
||||
<li>Support Django 2.1+ test client JSON data automatically serialized in <a href="https://github.com/encode/django-rest-framework/pull/6511">#6511</a> and fix a regression in <a href="https://github.com/encode/django-rest-framework/pull/9615">#9615</a></li>
|
||||
</ul>
|
||||
<h2 id="bug-fixes"><a class="toclink" href="#bug-fixes">Bug fixes</a></h2>
|
||||
<h4 id="bug-fixes_1"><a class="toclink" href="#bug-fixes_1">Bug fixes</a></h4>
|
||||
<ul>
|
||||
<li>Fix unique together validator to respect condition's fields from <code>UniqueConstraint</code> in <a href="https://github.com/encode/django-rest-framework/pull/9360">#9360</a></li>
|
||||
<li>Fix raising on nullable fields part of <code>UniqueConstraint</code> in <a href="https://github.com/encode/django-rest-framework/pull/9531">#9531</a></li>
|
||||
|
@ -599,19 +634,19 @@
|
|||
<li>Fix noisy warning and accept integers as min/max values of <code>DecimalField</code> in <a href="https://github.com/encode/django-rest-framework/pull/9515">#9515</a></li>
|
||||
<li>Fix usages of <code>open()</code> in <code>setup.py</code> in <a href="https://github.com/encode/django-rest-framework/pull/9661">#9661</a></li>
|
||||
</ul>
|
||||
<h2 id="translations"><a class="toclink" href="#translations">Translations</a></h2>
|
||||
<h4 id="translations_1"><a class="toclink" href="#translations_1">Translations</a></h4>
|
||||
<ul>
|
||||
<li>Add some missing Chinese translations in <a href="https://github.com/encode/django-rest-framework/pull/9505">#9505</a></li>
|
||||
<li>Fix spelling mistakes in Farsi language were corrected in <a href="https://github.com/encode/django-rest-framework/pull/9521">#9521</a></li>
|
||||
<li>Fixing and adding missing Brazilian Portuguese translations in <a href="https://github.com/encode/django-rest-framework/pull/9535">#9535</a></li>
|
||||
</ul>
|
||||
<h2 id="removals"><a class="toclink" href="#removals">Removals</a></h2>
|
||||
<h4 id="removals"><a class="toclink" href="#removals">Removals</a></h4>
|
||||
<ul>
|
||||
<li>Remove support for Python 3.8 in <a href="https://github.com/encode/django-rest-framework/pull/9670">#9670</a></li>
|
||||
<li>Remove long deprecated code from request wrapper in <a href="https://github.com/encode/django-rest-framework/pull/9441">#9441</a></li>
|
||||
<li>Remove deprecated <code>AutoSchema._get_reference</code> method in <a href="https://github.com/encode/django-rest-framework/pull/9525">#9525</a></li>
|
||||
</ul>
|
||||
<h2 id="documentation-and-internal-changes"><a class="toclink" href="#documentation-and-internal-changes">Documentation and internal changes</a></h2>
|
||||
<h4 id="documentation-and-internal-changes"><a class="toclink" href="#documentation-and-internal-changes">Documentation and internal changes</a></h4>
|
||||
<ul>
|
||||
<li>Provide tests for hashing of <code>OperandHolder</code> in <a href="https://github.com/encode/django-rest-framework/pull/9437">#9437</a></li>
|
||||
<li>Update documentation: Add <code>adrf</code> third party package in <a href="https://github.com/encode/django-rest-framework/pull/9198">#9198</a></li>
|
||||
|
@ -631,7 +666,7 @@
|
|||
<li>Fix a number of typos in the test suite in the docs in <a href="https://github.com/encode/django-rest-framework/pull/9662">#9662</a></li>
|
||||
<li>Add <code>django-pyoidc</code> as a third party authentication library in <a href="https://github.com/encode/django-rest-framework/pull/9667">#9667</a></li>
|
||||
</ul>
|
||||
<h2 id="new-contributors"><a class="toclink" href="#new-contributors">New Contributors</a></h2>
|
||||
<h4 id="new-contributors_1"><a class="toclink" href="#new-contributors_1">New Contributors</a></h4>
|
||||
<ul>
|
||||
<li><a href="https://github.com/maerteijn"><code>@maerteijn</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9198">#9198</a></li>
|
||||
<li><a href="https://github.com/FraCata00"><code>@FraCata00</code></a> made their first contribution in <a href="https://github.com/encode/django-rest-framework/pull/9444">#9444</a></li>
|
||||
|
|
|
@ -558,7 +558,7 @@
|
|||
<li><a href="https://github.com/philipn/django-rest-framework-chain">djangorestframework-chain</a> - Allows arbitrary chaining of both relations and lookup filters.</li>
|
||||
<li><a href="https://github.com/miki725/django-url-filter">django-url-filter</a> - Allows a safe way to filter data via human-friendly URLs. It is a generic library which is not tied to DRF but it provides easy integration with DRF.</li>
|
||||
<li><a href="https://github.com/manjitkumar/drf-url-filters">drf-url-filter</a> is a simple Django app to apply filters on drf <code>ModelViewSet</code>'s <code>Queryset</code> in a clean, simple and configurable way. It also supports validations on incoming query params and their values.</li>
|
||||
<li><a href="https://github.com/johnthagen/django-rest-framework-guardian2">django-rest-framework-guardian2</a> - Provides integration with django-guardian, including the <code>DjangoObjectPermissionsFilter</code> previously found in DRF.</li>
|
||||
<li><a href="https://github.com/rpkilby/django-rest-framework-guardian">django-rest-framework-guardian</a> - Provides integration with django-guardian, including the <code>DjangoObjectPermissionsFilter</code> previously found in DRF.</li>
|
||||
</ul>
|
||||
<h3 id="misc"><a class="toclink" href="#misc">Misc</a></h3>
|
||||
<ul>
|
||||
|
|
File diff suppressed because one or more lines are too long
140
sitemap.xml
140
sitemap.xml
|
@ -2,352 +2,352 @@
|
|||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/authentication/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/caching/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/content-negotiation/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/exceptions/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/fields/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/filtering/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/format-suffixes/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/generic-views/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/metadata/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/pagination/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/parsers/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/permissions/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/relations/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/renderers/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/requests/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/responses/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/reverse/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/routers/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/schemas/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/serializers/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/settings/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/status-codes/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/testing/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/throttling/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/validators/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/versioning/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/views/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/viewsets/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.0-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.1-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.10-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.11-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.12-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.13-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.14-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.15-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.16-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.2-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.3-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.4-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.5-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.6-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.7-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.8-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.9-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/contributing/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/funding/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/jobs/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/kickstarter-announcement/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/mozilla-grant/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/project-management/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/release-notes/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/third-party-packages/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/community/tutorials-and-resources/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/ajax-csrf-cors/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browsable-api/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browser-enhancements/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/documenting-your-api/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/html-and-forms/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/internationalization/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/topics/writable-nested-serializers/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/1-serialization/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/2-requests-and-responses/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/3-class-based-views/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/quickstart/</loc>
|
||||
<lastmod>2025-04-10</lastmod>
|
||||
<lastmod>2025-08-06</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
|
@ -538,6 +538,16 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
|
|||
</code></pre>
|
||||
<p>Notice that we've also added a new <code>'highlight'</code> field. This field is of the same type as the <code>url</code> field, except that it points to the <code>'snippet-highlight'</code> url pattern, instead of the <code>'snippet-detail'</code> url pattern.</p>
|
||||
<p>Because we've included format suffixed URLs such as <code>'.json'</code>, we also need to indicate on the <code>highlight</code> field that any format suffixed hyperlinks it returns should use the <code>'.html'</code> suffix.</p>
|
||||
<hr />
|
||||
<p><strong>Note:</strong></p>
|
||||
<p>When you are manually instantiating these serializers inside your views (e.g., in <code>SnippetDetail</code> or <code>SnippetList</code>), you <strong>must</strong> pass <code>context={'request': request}</code> so the serializer knows how to build absolute URLs. For example, instead of:</p>
|
||||
<pre><code>serializer = SnippetSerializer(snippet)
|
||||
</code></pre>
|
||||
<p>You must write:</p>
|
||||
<pre><code>serializer = SnippetSerializer(snippet, context={'request': request})
|
||||
</code></pre>
|
||||
<p>If your view is a subclass of <code>GenericAPIView</code>, you may use the <code>get_serializer_context()</code> as a convenience method.</p>
|
||||
<hr />
|
||||
<h2 id="making-sure-our-url-patterns-are-named"><a class="toclink" href="#making-sure-our-url-patterns-are-named">Making sure our URL patterns are named</a></h2>
|
||||
<p>If we're going to have a hyperlinked API, we need to make sure we name our URL patterns. Let's take a look at which URL patterns we need to name.</p>
|
||||
<ul>
|
||||
|
|
Loading…
Reference in New Issue
Block a user