Django

Code

Changeset 1256

Show
Ignore:
Timestamp:
11/15/05 18:25:48 (3 years ago)
Author:
adrian
Message:

Small style cleanup of docs/generic_views.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/generic_views.txt

    r1249 r1256  
    7777 
    7878``direct_to_template`` 
    79     Renders a given template using any extra parameters passed in the 
    80     urlpattern; requires the ``template`` argument. 
    81      
     79    Renders a given template, passing it a ``{{ params }}`` template variable, 
     80    which is a dictionary of the parameters captured in the URL. This requires 
     81    the ``template`` argument. 
     82 
    8283    For example, given the following URL patterns:: 
    83          
     84 
    8485        urlpatterns = patterns('django.views.generic.simple', 
    85             (r'^foo/$',             'direct_to_template', {'template' : 'foo_index'}), 
    86             (r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template' : 'foo_detail'}), 
     86            (r'^foo/$',             'direct_to_template', {'template': 'foo_index'}), 
     87            (r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template': 'foo_detail'}), 
    8788        ) 
    88          
     89 
    8990    ... a request to ``/foo/`` would cause the ``foo_index`` template to be 
    9091    rendered, and a request to ``/foo/15/`` would cause the ``foo_detail`` 
    9192    template to be rendered with a context variable ``{{ params.id }}`` that is 
    9293    set to ``15``. 
    93      
     94 
    9495``redirect_to`` 
    9596    Issue a redirect to a given URL. 
    9697 
    97     The given url may contain dict-style string formatting which will be 
     98    The given URL may contain dict-style string formatting, which will be 
    9899    interpolated against the params in the URL.  For example, to redirect from 
    99100    ``/foo/<id>/`` to ``/bar/<id>/``, you could use the following urlpattern:: 
     
    102103            ('^foo/(?p<id>\d+)/$', 'redirect_to', {'url' : '/bar/%(id)s/'}), 
    103104        ) 
    104          
    105     If the given url is ``None``, a HttpResponseGone (410) will be issued. 
     105 
     106    If the given URL is ``None``, an ``HttpResponseGone`` (410) will be issued. 
    106107 
    107108Using date-based generic views