Sunday, August 19, 2012

Re: Redirect to page with query string

This actually ended up working: http://dpaste.org/U0uY4/ 

On Saturday, August 18, 2012 5:46:28 PM UTC-7, Melvyn Sopacua wrote:
On 19-8-2012 2:26, Barry Morrison wrote:
> I have a view that displays images and gives me the ability to delete the
> images.  
>
> View url == /account/community/images/1 (1 == event_id)

Change <a href="images/{{event.pk}}"> to:
<a
href="images/{{event.pk}}?return_to=/account/community/images/{{event.pk}}">.
Keep passing this return_to parameter around. It helps to use the
request context processor so you can just grab it from the request
context in a template.

> I'd like the success_url to be /account/community/images{{ event.id }} the
> page I came from

Subclass the Deleteview and implement get_success_url(), using
request.GET['return_to'] or if you decide to put a hidden input in the
delete form with the return_to value then obviously it's in request.POST.
--
Melvyn Sopacua

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