Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#9774 closed (invalid)

direct_to_template example url pattern is incorrect

Reported by: agabel 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: UI/UX:

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 Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed
  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 Changed 7 years ago by ubernostrum

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