aboutsummaryrefslogtreecommitdiffstats
path: root/api-guide/format-suffixes/index.html
diff options
context:
space:
mode:
authorXavier Ordoquy2015-01-10 10:41:12 +0100
committerXavier Ordoquy2015-01-10 10:41:12 +0100
commitd8dbd8679080035de4e785a8e7b998fb01f4052b (patch)
treebaceae881ed53e5a25295367f6a58bb6fe1c131e /api-guide/format-suffixes/index.html
parentc1e4ec0c64933da5411e4cc3e63894d5f82cc337 (diff)
downloaddjango-rest-framework-d8dbd8679080035de4e785a8e7b998fb01f4052b.tar.bz2
Update documentation
Diffstat (limited to 'api-guide/format-suffixes/index.html')
-rw-r--r--api-guide/format-suffixes/index.html10
1 files changed, 10 insertions, 0 deletions
diff --git a/api-guide/format-suffixes/index.html b/api-guide/format-suffixes/index.html
index 22181b1b..d7d74db9 100644
--- a/api-guide/format-suffixes/index.html
+++ b/api-guide/format-suffixes/index.html
@@ -428,6 +428,16 @@ def comment_list(request, format=None):
</code></pre>
<p>The name of the kwarg used may be modified by using the <code>FORMAT_SUFFIX_KWARG</code> setting.</p>
<p>Also note that <code>format_suffix_patterns</code> does not support descending into <code>include</code> URL patterns.</p>
+<h3 id="using-with-i18n_patterns">Using with <code>i18n_patterns</code></h3>
+<p>If using the <code>i18n_patterns</code> function provided by Django, as well as <code>format_suffix_patterns</code> you should make sure that the <code>i18n_patterns</code> function is applied as the final, or outermost function. For example:</p>
+<pre><code>url patterns = [
+ …
+]
+
+urlpatterns = i18n_patterns(
+ format_suffix_patterns(urlpatterns, allowed=['json', 'html'])
+)
+</code></pre>
<hr />
<h2 id="accept-headers-vs-format-suffixes">Accept headers vs. format suffixes</h2>
<p>There seems to be a view among some of the Web community that filename extensions are not a RESTful pattern, and that <code>HTTP Accept</code> headers should always be used instead.</p>