mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-04 21:53:09 +03:00
Deployed 070c32f4
with MkDocs version: 1.1.2
This commit is contained in:
parent
62f6a3a5ca
commit
e54bab2700
|
@ -693,7 +693,7 @@ class UserListView(generics.ListAPIView):
|
|||
<ul>
|
||||
<li>'^' Starts-with search.</li>
|
||||
<li>'=' Exact matches.</li>
|
||||
<li>'@' Full-text search. (Currently only supported Django's <a href="https://docs.djangoproject.com/en/dev/ref/contrib/postgres/search/">PostgreSQL backend</a>.)</li>
|
||||
<li>'@' Full-text search. (Currently only supported Django's <a href="https://docs.djangoproject.com/en/stable/ref/contrib/postgres/search/">PostgreSQL backend</a>.)</li>
|
||||
<li>'$' Regex search.</li>
|
||||
</ul>
|
||||
<p>For example:</p>
|
||||
|
|
|
@ -470,7 +470,7 @@
|
|||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#media_typenone">media_type=None</a>
|
||||
<a href="#accepted_media_typenone">accepted_media_type=None</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
@ -530,7 +530,7 @@
|
|||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#xlsx-binary-spreadsheet-endpoints">XLSX (Binary Spreadsheet Endpoints)</a>
|
||||
<a href="#microsoft-excel-xlsx-binary-spreadsheet-endpoints">Microsoft Excel: XLSX (Binary Spreadsheet Endpoints)</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
@ -744,12 +744,12 @@ def simple_html_view(request):
|
|||
<p><strong>.charset</strong>: <code>utf-8</code></p>
|
||||
<hr />
|
||||
<h1 id="custom-renderers"><a class="toclink" href="#custom-renderers">Custom renderers</a></h1>
|
||||
<p>To implement a custom renderer, you should override <code>BaseRenderer</code>, set the <code>.media_type</code> and <code>.format</code> properties, and implement the <code>.render(self, data, media_type=None, renderer_context=None)</code> method.</p>
|
||||
<p>To implement a custom renderer, you should override <code>BaseRenderer</code>, set the <code>.media_type</code> and <code>.format</code> properties, and implement the <code>.render(self, data, accepted_media_type=None, renderer_context=None)</code> method.</p>
|
||||
<p>The method should return a bytestring, which will be used as the body of the HTTP response.</p>
|
||||
<p>The arguments passed to the <code>.render()</code> method are:</p>
|
||||
<h3 id="data"><a class="toclink" href="#data"><code>data</code></a></h3>
|
||||
<p>The request data, as set by the <code>Response()</code> instantiation.</p>
|
||||
<h3 id="media_typenone"><a class="toclink" href="#media_typenone"><code>media_type=None</code></a></h3>
|
||||
<h3 id="accepted_media_typenone"><a class="toclink" href="#accepted_media_typenone"><code>accepted_media_type=None</code></a></h3>
|
||||
<p>Optional. If provided, this is the accepted media type, as determined by the content negotiation stage.</p>
|
||||
<p>Depending on the client's <code>Accept:</code> header, this may be more specific than the renderer's <code>media_type</code> attribute, and may include media type parameters. For example <code>"application/json; nested=true"</code>.</p>
|
||||
<h3 id="renderer_contextnone"><a class="toclink" href="#renderer_contextnone"><code>renderer_context=None</code></a></h3>
|
||||
|
@ -765,7 +765,7 @@ class PlainTextRenderer(renderers.BaseRenderer):
|
|||
media_type = 'text/plain'
|
||||
format = 'txt'
|
||||
|
||||
def render(self, data, media_type=None, renderer_context=None):
|
||||
def render(self, data, accepted_media_type=None, renderer_context=None):
|
||||
return smart_text(data, encoding=self.charset)
|
||||
</code></pre>
|
||||
<h2 id="setting-the-character-set"><a class="toclink" href="#setting-the-character-set">Setting the character set</a></h2>
|
||||
|
@ -775,7 +775,7 @@ class PlainTextRenderer(renderers.BaseRenderer):
|
|||
format = 'txt'
|
||||
charset = 'iso-8859-1'
|
||||
|
||||
def render(self, data, media_type=None, renderer_context=None):
|
||||
def render(self, data, accepted_media_type=None, renderer_context=None):
|
||||
return data.encode(self.charset)
|
||||
</code></pre>
|
||||
<p>Note that if a renderer class returns a unicode string, then the response content will be coerced into a bytestring by the <code>Response</code> class, with the <code>charset</code> attribute set on the renderer used to determine the encoding.</p>
|
||||
|
@ -787,7 +787,7 @@ class PlainTextRenderer(renderers.BaseRenderer):
|
|||
charset = None
|
||||
render_style = 'binary'
|
||||
|
||||
def render(self, data, media_type=None, renderer_context=None):
|
||||
def render(self, data, accepted_media_type=None, renderer_context=None):
|
||||
return data
|
||||
</code></pre>
|
||||
<hr />
|
||||
|
@ -898,11 +898,11 @@ In this case you can underspecify the media types it should respond to, by using
|
|||
</code></pre>
|
||||
<h2 id="messagepack"><a class="toclink" href="#messagepack">MessagePack</a></h2>
|
||||
<p><a href="https://msgpack.org/">MessagePack</a> is a fast, efficient binary serialization format. <a href="https://github.com/juanriaza">Juan Riaza</a> maintains the <a href="https://github.com/juanriaza/django-rest-framework-msgpack">djangorestframework-msgpack</a> package which provides MessagePack renderer and parser support for REST framework.</p>
|
||||
<h2 id="xlsx-binary-spreadsheet-endpoints"><a class="toclink" href="#xlsx-binary-spreadsheet-endpoints">XLSX (Binary Spreadsheet Endpoints)</a></h2>
|
||||
<p>XLSX is the world's most popular binary spreadsheet format. <a href="https://github.com/flipperpa">Tim Allen</a> of <a href="https://github.com/wharton">The Wharton School</a> maintains <a href="https://github.com/wharton/drf-renderer-xlsx">drf-renderer-xlsx</a>, which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis.</p>
|
||||
<h2 id="microsoft-excel-xlsx-binary-spreadsheet-endpoints"><a class="toclink" href="#microsoft-excel-xlsx-binary-spreadsheet-endpoints">Microsoft Excel: XLSX (Binary Spreadsheet Endpoints)</a></h2>
|
||||
<p>XLSX is the world's most popular binary spreadsheet format. <a href="https://github.com/flipperpa">Tim Allen</a> of <a href="https://github.com/wharton">The Wharton School</a> maintains <a href="https://github.com/wharton/drf-excel">drf-excel</a>, which renders an endpoint as an XLSX spreadsheet using OpenPyXL, and allows the client to download it. Spreadsheets can be styled on a per-view basis.</p>
|
||||
<h4 id="installation-configuration_3"><a class="toclink" href="#installation-configuration_3">Installation & configuration</a></h4>
|
||||
<p>Install using pip.</p>
|
||||
<pre><code>$ pip install drf-renderer-xlsx
|
||||
<pre><code>$ pip install drf-excel
|
||||
</code></pre>
|
||||
<p>Modify your REST framework settings.</p>
|
||||
<pre><code>REST_FRAMEWORK = {
|
||||
|
@ -911,14 +911,14 @@ In this case you can underspecify the media types it should respond to, by using
|
|||
'DEFAULT_RENDERER_CLASSES': [
|
||||
'rest_framework.renderers.JSONRenderer',
|
||||
'rest_framework.renderers.BrowsableAPIRenderer',
|
||||
'drf_renderer_xlsx.renderers.XLSXRenderer',
|
||||
'drf_excel.renderers.XLSXRenderer',
|
||||
],
|
||||
}
|
||||
</code></pre>
|
||||
<p>To avoid having a file streamed without a filename (which the browser will often default to the filename "download", with no extension), we need to use a mixin to override the <code>Content-Disposition</code> header. If no filename is provided, it will default to <code>export.xlsx</code>. For example:</p>
|
||||
<pre><code>from rest_framework.viewsets import ReadOnlyModelViewSet
|
||||
from drf_renderer_xlsx.mixins import XLSXFileMixin
|
||||
from drf_renderer_xlsx.renderers import XLSXRenderer
|
||||
from drf_excel.mixins import XLSXFileMixin
|
||||
from drf_excel.renderers import XLSXRenderer
|
||||
|
||||
from .models import MyExampleModel
|
||||
from .serializers import MyExampleSerializer
|
||||
|
|
|
@ -488,6 +488,7 @@
|
|||
<p>Another scenario where you might want to use multiple throttles would be if you need to impose different constraints on different parts of the API, due to some services being particularly resource-intensive.</p>
|
||||
<p>Multiple throttles can also be used if you want to impose both burst throttling rates, and sustained throttling rates. For example, you might want to limit a user to a maximum of 60 requests per minute, and 1000 requests per day.</p>
|
||||
<p>Throttles do not necessarily only refer to rate-limiting requests. For example a storage service might also need to throttle against bandwidth, and a paid data service might want to throttle against a certain number of a records being accessed.</p>
|
||||
<p><strong>The application-level throttling that REST framework provides should not be considered a security measure or protection against brute forcing or denial-of-service attacks. Deliberately malicious actors will always be able to spoof IP origins, and application-level throttling is intended for implementing policies such as different business tiers and basic protections against service over-use.</strong></p>
|
||||
<h2 id="how-throttling-is-determined"><a class="toclink" href="#how-throttling-is-determined">How throttling is determined</a></h2>
|
||||
<p>As with permissions and authentication, throttling in REST framework is always defined as a list of classes.</p>
|
||||
<p>Before running the main body of the view each throttle in the list is checked.
|
||||
|
|
|
@ -645,8 +645,9 @@ Framework.</p>
|
|||
<p>For support please see the <a href="https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework">REST framework discussion group</a>, try the <code>#restframework</code> channel on <code>irc.libera.chat</code>, or raise a question on <a href="https://stackoverflow.com/">Stack Overflow</a>, making sure to include the <a href="https://stackoverflow.com/questions/tagged/django-rest-framework">'django-rest-framework'</a> tag.</p>
|
||||
<p>For priority support please sign up for a <a href="https://fund.django-rest-framework.org/topics/funding/">professional or premium sponsorship plan</a>.</p>
|
||||
<h2 id="security"><a class="toclink" href="#security">Security</a></h2>
|
||||
<p>If you believe you’ve found something in Django REST framework which has security implications, please <strong>do not raise the issue in a public forum</strong>.</p>
|
||||
<p>Send a description of the issue via email to <a href="mailto:rest-framework-security@googlegroups.com">rest-framework-security@googlegroups.com</a>. The project maintainers will then work with you to resolve any issues where required, prior to any public disclosure.</p>
|
||||
<p>Security issues are handled under the supervision of the <a href="https://www.djangoproject.com/foundation/teams/#security-team">Django security team</a>.</p>
|
||||
<p><strong>Please report security issues by emailing security@djangoproject.com</strong>.</p>
|
||||
<p>The project maintainers will then work with you to resolve any issues where required, prior to any public disclosure.</p>
|
||||
<h2 id="license"><a class="toclink" href="#license">License</a></h2>
|
||||
<p>Copyright © 2011-present, <a href="https://www.encode.io/">Encode OSS Ltd</a>.
|
||||
All rights reserved.</p>
|
||||
|
|
File diff suppressed because one or more lines are too long
134
sitemap.xml
134
sitemap.xml
|
@ -1,271 +1,271 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
|
||||
<loc>https://www.django-rest-framework.org/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/quickstart/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/1-serialization/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/2-requests-and-responses/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/3-class-based-views/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/5-relationships-and-hyperlinked-apis/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/requests/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/responses/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/views/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/generic-views/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/viewsets/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/routers/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/parsers/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/renderers/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/serializers/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/fields/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/relations/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/validators/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/authentication/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/permissions/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/caching/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/throttling/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/filtering/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/pagination/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/versioning/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/content-negotiation/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/metadata/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/schemas/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/format-suffixes/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/reverse/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/exceptions/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/status-codes/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/testing/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/api-guide/settings/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/documenting-your-api/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/api-clients/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/internationalization/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/ajax-csrf-cors/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/html-and-forms/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browser-enhancements/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/browsable-api/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/topics/rest-hypermedia-hateoas/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/tutorials-and-resources/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/third-party-packages/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/contributing/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/project-management/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/release-notes/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.13-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.12-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.11-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.10-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.9-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.8-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.7-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.6-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.5-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.4-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.3-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.2-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.1-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/3.0-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/kickstarter-announcement/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/mozilla-grant/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/funding/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url><url>
|
||||
<loc>https://www.django-rest-framework.org/community/jobs/</loc>
|
||||
<lastmod>2022-01-11</lastmod>
|
||||
<lastmod>2022-03-21</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
BIN
sitemap.xml.gz
BIN
sitemap.xml.gz
Binary file not shown.
|
@ -455,8 +455,8 @@
|
|||
<p>You can change the default language by using the standard Django <code>LANGUAGE_CODE</code> setting:</p>
|
||||
<pre><code>LANGUAGE_CODE = "es-es"
|
||||
</code></pre>
|
||||
<p>You can turn on per-request language requests by adding <code>LocalMiddleware</code> to your <code>MIDDLEWARE_CLASSES</code> setting:</p>
|
||||
<pre><code>MIDDLEWARE_CLASSES = [
|
||||
<p>You can turn on per-request language requests by adding <code>LocalMiddleware</code> to your <code>MIDDLEWARE</code> setting:</p>
|
||||
<pre><code>MIDDLEWARE = [
|
||||
...
|
||||
'django.middleware.locale.LocaleMiddleware'
|
||||
]
|
||||
|
@ -519,7 +519,7 @@ available for Django to use. You should see a message like <code>processing file
|
|||
</ol>
|
||||
<p>If you're only translating custom error messages that exist inside your project codebase you don't need to copy the REST framework source <code>django.po</code> file into a <code>LOCALE_PATHS</code> folder, and can instead simply run Django's standard <code>makemessages</code> process.</p>
|
||||
<h2 id="how-the-language-is-determined"><a class="toclink" href="#how-the-language-is-determined">How the language is determined</a></h2>
|
||||
<p>If you want to allow per-request language preferences you'll need to include <code>django.middleware.locale.LocaleMiddleware</code> in your <code>MIDDLEWARE_CLASSES</code> setting.</p>
|
||||
<p>If you want to allow per-request language preferences you'll need to include <code>django.middleware.locale.LocaleMiddleware</code> in your <code>MIDDLEWARE</code> setting.</p>
|
||||
<p>You can find more information on how the language preference is determined in the <a href="https://docs.djangoproject.com/en/stable/topics/i18n/translation/#how-django-discovers-language-preference">Django documentation</a>. For reference, the method is:</p>
|
||||
<ol>
|
||||
<li>First, it looks for the language prefix in the requested URL.</li>
|
||||
|
|
|
@ -537,8 +537,8 @@ from snippets import views
|
|||
|
||||
# Create a router and register our viewsets with it.
|
||||
router = DefaultRouter()
|
||||
router.register(r'snippets', views.SnippetViewSet)
|
||||
router.register(r'users', views.UserViewSet)
|
||||
router.register(r'snippets', views.SnippetViewSet,basename="snippets")
|
||||
router.register(r'users', views.UserViewSet,basename="users")
|
||||
|
||||
# The API URLs are now determined automatically by the router.
|
||||
urlpatterns = [
|
||||
|
|
Loading…
Reference in New Issue
Block a user