Friday, February 18, 2011

Using success_url with reverse() in class-based generic view

Hi users,

I have a CreateView which I'd like to redirect to a custom success_url
defined in my URLconf. As I want to stick to the DRY-principle I just
did the following:

success_url = reverse("my-named-url")

Unfortunately, this breaks my site by raising an
"ImproperlyConfigured: The included urlconf doesn't have any patterns
in it". Removing success_url and setting the model's
get_absolute_url() to the following works fine:

def get_absolute_url(self):
return reverse("my-named-url")

I could reproduce this with a brand new project/application so I don't
think this has something to do with my setup.

Can anyone confirm this issue?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate