Wednesday, September 26, 2012

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

Sometimes, though, you may need to pass variables to a success url. In that case, I'd use the "get_success_url" method so you can access the 'self' attributes.

On Wed, Sep 26, 2012 at 1:32 PM, Germán <germanlarrainm@gmail.com> wrote:
Just for the record.

Since Django 1.4, the best way to set up success_url in class-based generic views with url names is:
success_url = reverse_lazy('my_url_name')

On Wednesday, September 21, 2011 4:53:56 PM UTC-3, Xavier Ordoquy wrote:
Hi,

You can also use get_success_url for that:

class ContactView(generic.FormView):
    form_class = ContactForm

    def get_success_url(self):
        return reverse('contact-sent')

Regards,
Xavier

Linovia.

Le 21 sept. 2011 à 00:08, Daniel P a écrit :

> Same problem. You'r not alone!
>
> this is also a solution: http://djangosnippets.org/snippets/2445/
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.

> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/bm1tU2fvPAAJ.

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.

--
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.

No comments:

Post a Comment