#17361: Add a way to reverse URLs for callables
-------------------------------------+-------------------------------------
     Reporter:  anatoly techtonik    |                    Owner:  nobody
  <techtonik@…>                      |                   Status:  closed
         Type:  New feature          |                  Version:  1.2
    Component:  contrib.syndication  |               Resolution:  wontfix
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by anatoly techtonik <techtonik@…>):

 Replying to [comment:1 lukeplant]:
 > Yes, I believe it is impossible to reverse URLs defined only by a
 callable in the template. The solution is to either:
 >
 > 1) refer to your view by a  string (dotted path) - which is possible in
 this case if you do something like `codereview_feeds =
 codereview.feeds.AllFeed()` in the relevant views.py.  Or:

 I need to refer to codereview.feeds.AllFeed() from base template, which is
 inherited by many views. Cooking this variable in every view is ugly.

 > 2) Give your URL a name.

 That's also ugly, because it duplicates the code for every view. I looked
 at the code that does URL reversing and IMO it is overarchitectured, so I
 am not surprised you're not too enthusiastic to support that.


 BTW, I am not the first to ask about reverse URLs for syndication
 framework:
 1. https://groups.google.com/forum/#!topic/django-users/Z9eJczJvtI8
 2. http://stackoverflow.com/questions/3402362/how-to-reverse-django-feed-
 url
 3. http://stackoverflow.com/questions/2604823/django-reverse-lookup-url-
 of-feeds

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17361#comment:5>
Django <https://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.

Reply via email to