I've just been screwing around with my urlpatterns, trying to clean
them up. Mostly, I've been trying to remove all hard coded urls
wherever they are, in templates and whatnot, by adding a name="foo" to
my urlpatterns and then accessing them with {% url %} and reverse().

I'm wondering though, is it possible to use reverse() and pass it some
args, to use it as the post_save_redirect in generic views? I've been
trying to get it to work, but no luck so far... maybe I'm not passing
the args properly? Or maybe it's not even possible?

from django.conf.urls.defaults import *
from django.views.generic.list_detail import object_detail
from django.views.generic.create_update import create_object
from django.core.urlresolvers import reverse
from apps.myapp.models import MyThing
urlpatterns = patterns('',
        (r'^view/(?P<object_id>\d+)/$', object_detail,
                {'queryset' : MyThing.objects.all() },
                'mything-view'),
        (r'^create/$', create_object,
                {'model' : MyThing,
                'post_save_redirect' : reverse('mything-view', args=(id,)) },
                'mything-create'),
)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to