Permalink
Browse files

Added some sphinx cross-reference links to the built-in template tags…

… and filters in multiple areas of the documentation. Also fixed a few minor inconsistencies and did a little PEP8 cleanup while I was at it.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 0d9b6a5 commit c2b9f6496e59c9268fb265ea80df8c8d7ec88034 @jphalip jphalip committed Oct 3, 2011
@@ -199,7 +199,7 @@ passed around inside the template code:
Internally, these strings are of type ``EscapeString`` or
``EscapeUnicode``. Generally you don't have to worry about these; they
- exist for the implementation of the ``escape`` filter.
+ exist for the implementation of the :tfilter:`escape` filter.
Template filter code falls into one of two situations:
@@ -501,8 +501,8 @@ safe.
To make sure your template tags are thread safe, you should never store state
information on the node itself. For example, Django provides a builtin
-``cycle`` template tag that cycles among a list of given strings each time it's
-rendered:
+:ttag:`cycle` template tag that cycles among a list of given strings each time
+it's rendered:
.. code-block:: html+django
@@ -110,7 +110,7 @@ Running a threaded server on a TCP port::
Running a preforked server on a Unix domain socket::
./manage.py runfcgi method=prefork socket=/home/user/mysite.sock pidfile=django.pid
-
+
.. admonition:: Socket security
Django's default umask requires that the webserver and the Django fastcgi
@@ -223,7 +223,8 @@ This is probably the most common case, if you're using Django's admin site:
.. _mod_rewrite: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Django will automatically use the pre-rewrite version of the URL when
-constructing URLs with the ``{% url %}`` template tag (and similar methods).
+constructing URLs with the :ttag:`{% url %}<url>` template tag (and similar
+methods).
Using mod_fcgid as alternative to mod_fastcgi
----------------------------------------------
@@ -409,8 +410,8 @@ Because many of these fastcgi-based solutions require rewriting the URL at
some point inside the Web server, the path information that Django sees may not
resemble the original URL that was passed in. This is a problem if the Django
application is being served from under a particular prefix and you want your
-URLs from the ``{% url %}`` tag to look like the prefix, rather than the
-rewritten version, which might contain, for example, ``mysite.fcgi``.
+URLs from the :ttag:`{% url %}<url>` tag to look like the prefix, rather than
+the rewritten version, which might contain, for example, ``mysite.fcgi``.
Django makes a good attempt to work out what the real script name prefix
should be. In particular, if the Web server sets the ``SCRIPT_URL`` (specific
@@ -420,9 +420,10 @@ on the object ``poll``. Failing that, it tries an attribute lookup -- which
works, in this case. If attribute lookup had failed, it would've tried a
list-index lookup.
-Method-calling happens in the ``{% for %}`` loop: ``poll.choice_set.all`` is
-interpreted as the Python code ``poll.choice_set.all()``, which returns an
-iterable of Choice objects and is suitable for use in the ``{% for %}`` tag.
+Method-calling happens in the :ttag:`{% for %}<for>` loop:
+``poll.choice_set.all`` is interpreted as the Python code
+``poll.choice_set.all()``, which returns an iterable of Choice objects and is
+suitable for use in the :ttag:`{% for %}<for>` tag.
See the :doc:`template guide </topics/templates>` for more about templates.
@@ -49,13 +49,13 @@ A quick rundown:
data), we need to worry about Cross Site Request Forgeries.
Thankfully, you don't have to worry too hard, because Django comes with
a very easy-to-use system for protecting against it. In short, all POST
- forms that are targeted at internal URLs should use the ``{% csrf_token %}``
- template tag.
+ forms that are targeted at internal URLs should use the
+ :ttag:`{% csrf_token %}<csrf_token>` template tag.
-The ``{% csrf_token %}`` tag requires information from the request object, which
-is not normally accessible from within the template context. To fix this, a
-small adjustment needs to be made to the ``detail`` view, so that it looks like
-the following::
+The :ttag:`{% csrf_token %}<csrf_token>` tag requires information from the
+request object, which is not normally accessible from within the template
+context. To fix this, a small adjustment needs to be made to the ``detail``
+view, so that it looks like the following::
from django.template import RequestContext
# ...
@@ -1962,8 +1962,8 @@ if you specifically wanted the admin view from the admin instance named
For more details, see the documentation on :ref:`reversing namespaced URLs
<topics-http-reversing-url-namespaces>`.
-To allow easier reversing of the admin urls in templates, Django provides an
-``admin_url`` filter which takes an action as argument:
+To allow easier reversing of the admin urls in templates, Django provides an
+``admin_urlname`` filter which takes an action as argument:
.. code-block:: html+django
@@ -1974,5 +1974,5 @@ To allow easier reversing of the admin urls in templates, Django provides an
The action in the examples above match the last part of the URL names for
:class:`ModelAdmin` instances described above. The ``opts`` variable can be any
-object which has an ``app_label`` and ``module_name`` and is usually supplied
+object which has an ``app_label`` and ``module_name`` and is usually supplied
by the admin views for the current model.
@@ -493,8 +493,9 @@ django.core.context_processors.csrf
.. versionadded:: 1.2
-This processor adds a token that is needed by the ``csrf_token`` template tag
-for protection against :doc:`Cross Site Request Forgeries </ref/contrib/csrf>`.
+This processor adds a token that is needed by the :ttag:`csrf_token` template
+tag for protection against :doc:`Cross Site Request Forgeries
+</ref/contrib/csrf>`.
django.core.context_processors.request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Oops, something went wrong.

0 comments on commit c2b9f64

Please sign in to comment.