Hello,
Can I use reverse() in urlpatterns, similar to the following?
urlpatterns = patterns('',
...
(r'^apps/$', list_detail.object_list,
{'queryset': App.objects.all()},
'app-list'),
(r'^app/new/$': create_update.create_object,
{'model': App, 'post_save_redirect': reverse('app-list')},
'app-new'),
...
)
When I try this, I get NoReverseMatch at /apps/: Reverse for 'app-list'
with arguments '()' and keyword arguments '{}' not found.
I'd like to avoid hard-coding URLs. Is there a way to do that?
I'm aware that I could probably abuse get_absolute_url for that.
However, I'll need to implement more complex workflows where the same
URL is going to be "called" from different pages on the site and will
have to return back to the "calling" page (not unlike admin's popup
windows, albeit without popups). What is the best way to do that?
I'm using Django 1.0.
Thanks in advance,
--
Baurzhan Ismagulov
http://www.kz-easy.com/