#7879: reverse/url tag assumes view is a module-level callable
---------------------------------------------+------------------------------
Reporter: miracle2k | Owner: nobody
Status: closed | Milestone: post-1.0
Component: Core framework | Version: SVN
Resolution: wontfix | Keywords:
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------+------------------------------
Changes (by mtredinnick):
* status: new => closed
* resolution: => wontfix
Comment:
This is really fiddly to handle all the cases, since it requires stepping
through one dotted piece at a time checking if it's something to import or
a class or whatever. Since reverse-resolving is already slow to start up
as it is, it's not really worth it.
The correct thing to do here is to use the named URL-pattern form:
{{{
#!python
url(r'^admin/(.*)', admin.sites.root, name='my-admin-root'),
}}}
and then `{% url my-admin-root "" %}` will do work as you expect.
It's arguably a bug that the empty string is needed if you only want the
root, but that's an issue with `reverse()` and I've opened #9239 for that.
--
Ticket URL: <http://code.djangoproject.com/ticket/7879#comment:3>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---