Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#9774 closed (invalid)

direct_to_template example url pattern is incorrect

Reported by: Austin Gabel Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The direct_to_template example url pattern seems incorrect. This is what is displayed in the current documentation:

urlpatterns = patterns('django.views.generic.simple',
    (r'^foo/$',             'direct_to_template', {'template': 'foo_index.html'}),
    (r'^foo/(?P<id>\d+)/$', 'direct_to_template', {'template': 'foo_detail.html'}),
)

I believe direct_to_template should not be in quotes. It should look like this:

urlpatterns = patterns('django.views.generic.simple',
    (r'^foo/$',             direct_to_template, {'template': 'foo_index.html'}),
    (r'^foo/(?P<id>\d+)/$', direct_to_template, {'template': 'foo_detail.html'}),
)

Change History (2)

comment:1 by anonymous, 16 years ago

Resolution: invalid
Status: newclosed
  1. If this was done, it would make absolutely no sense to put the "django.views.generic.simple" as the first argument to the patterns() call.
  1. it is consistent with every other example on that page
  1. what's up there works.

comment:2 by James Bennett, 16 years ago

In order to directly reference the view as itself (in other words, in order to mention it directly instead of putting its name in a string), you must actually import it into the URLConf. So, no, your proposal wouldn't work at all without further changes.

Note: See TracTickets for help on using tickets.
Back to Top