mirror of
https://github.com/django/django.git
synced 2025-03-09 08:52:32 +00:00
Fixed #3696 -- Fixed inline documentation to avoid some HTML validity issues.
Patch from Simon Greenhill. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4700 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
659aa8f01a
commit
ee1ca89dd4
@ -435,6 +435,15 @@ def cycle(parser, token):
|
|||||||
cycle = register.tag(cycle)
|
cycle = register.tag(cycle)
|
||||||
|
|
||||||
def debug(parser, token):
|
def debug(parser, token):
|
||||||
|
"""
|
||||||
|
Output a whole load of debugging information, including the current context and imported modules.
|
||||||
|
|
||||||
|
Sample usage::
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
{% debug %}
|
||||||
|
</pre>
|
||||||
|
"""
|
||||||
return DebugNode()
|
return DebugNode()
|
||||||
debug = register.tag(debug)
|
debug = register.tag(debug)
|
||||||
|
|
||||||
@ -538,21 +547,6 @@ def do_for(parser, token):
|
|||||||
do_for = register.tag("for", do_for)
|
do_for = register.tag("for", do_for)
|
||||||
|
|
||||||
def do_ifequal(parser, token, negate):
|
def do_ifequal(parser, token, negate):
|
||||||
"""
|
|
||||||
Output the contents of the block if the two arguments equal/don't equal each other.
|
|
||||||
|
|
||||||
Examples::
|
|
||||||
|
|
||||||
{% ifequal user.id comment.user_id %}
|
|
||||||
...
|
|
||||||
{% endifequal %}
|
|
||||||
|
|
||||||
{% ifnotequal user.id comment.user_id %}
|
|
||||||
...
|
|
||||||
{% else %}
|
|
||||||
...
|
|
||||||
{% endifnotequal %}
|
|
||||||
"""
|
|
||||||
bits = list(token.split_contents())
|
bits = list(token.split_contents())
|
||||||
if len(bits) != 3:
|
if len(bits) != 3:
|
||||||
raise TemplateSyntaxError, "%r takes two arguments" % bits[0]
|
raise TemplateSyntaxError, "%r takes two arguments" % bits[0]
|
||||||
@ -568,11 +562,27 @@ def do_ifequal(parser, token, negate):
|
|||||||
|
|
||||||
#@register.tag
|
#@register.tag
|
||||||
def ifequal(parser, token):
|
def ifequal(parser, token):
|
||||||
|
"""
|
||||||
|
Output the contents of the block if the two arguments equal each other.
|
||||||
|
|
||||||
|
Examples::
|
||||||
|
|
||||||
|
{% ifequal user.id comment.user_id %}
|
||||||
|
...
|
||||||
|
{% endifequal %}
|
||||||
|
|
||||||
|
{% ifnotequal user.id comment.user_id %}
|
||||||
|
...
|
||||||
|
{% else %}
|
||||||
|
...
|
||||||
|
{% endifnotequal %}
|
||||||
|
"""
|
||||||
return do_ifequal(parser, token, False)
|
return do_ifequal(parser, token, False)
|
||||||
ifequal = register.tag(ifequal)
|
ifequal = register.tag(ifequal)
|
||||||
|
|
||||||
#@register.tag
|
#@register.tag
|
||||||
def ifnotequal(parser, token):
|
def ifnotequal(parser, token):
|
||||||
|
"""Output the contents of the block if the two arguments are not equal. See ifequal"""
|
||||||
return do_ifequal(parser, token, True)
|
return do_ifequal(parser, token, True)
|
||||||
ifnotequal = register.tag(ifnotequal)
|
ifnotequal = register.tag(ifnotequal)
|
||||||
|
|
||||||
@ -889,8 +899,9 @@ templatetag = register.tag(templatetag)
|
|||||||
|
|
||||||
def url(parser, token):
|
def url(parser, token):
|
||||||
"""
|
"""
|
||||||
Returns an absolute URL matching given view with its parameters. This is a
|
Returns an absolute URL matching given view with its parameters.
|
||||||
way to define links that aren't tied to a particular url configuration:
|
|
||||||
|
This is a way to define links that aren't tied to a particular url configuration::
|
||||||
|
|
||||||
{% url path.to.some_view arg1,arg2,name1=value1 %}
|
{% url path.to.some_view arg1,arg2,name1=value1 %}
|
||||||
|
|
||||||
@ -901,16 +912,16 @@ def url(parser, token):
|
|||||||
URL. All arguments for the URL should be present.
|
URL. All arguments for the URL should be present.
|
||||||
|
|
||||||
For example if you have a view ``app_name.client`` taking client's id and
|
For example if you have a view ``app_name.client`` taking client's id and
|
||||||
the corresponding line in a urlconf looks like this:
|
the corresponding line in a urlconf looks like this::
|
||||||
|
|
||||||
('^client/(\d+)/$', 'app_name.client')
|
('^client/(\d+)/$', 'app_name.client')
|
||||||
|
|
||||||
and this app's urlconf is included into the project's urlconf under some
|
and this app's urlconf is included into the project's urlconf under some
|
||||||
path:
|
path::
|
||||||
|
|
||||||
('^clients/', include('project_name.app_name.urls'))
|
('^clients/', include('project_name.app_name.urls'))
|
||||||
|
|
||||||
then in a template you can create a link for a certain client like this:
|
then in a template you can create a link for a certain client like this::
|
||||||
|
|
||||||
{% url app_name.client client.id %}
|
{% url app_name.client client.id %}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user