On Oct 16, 5:35 am, Divan Roulant <[EMAIL PROTECTED]> wrote:
> I loose request data when I call a view with reverse from a previous
> view. Here is what I do:
>
> def my_first_view(request):
> # Processing here
> return HttpResponseRedirect(reverse('my_second_view,
> args=(request,)))
>
> def my_second_view(request):
> # I would like to processing request data from the previous view,
> but request is empty
> return render_to_response('results.html', ...)
Kinda pointing out the obvious, but the views ARE, after all, just
Python functions.
USUALLY you want to redirect after processing a form, for example, but
maybe in your case you don't?
Note that there are some caveats to doing this (like, what happens if
a user hits [Reload] on the second page, which will still have the
"original" URL), but in your case you might be able to skip all the
reverse-lookups and url evaluation, and simply:
def my_first_view(request):
# Processing here
# Don't send a response from here, just pass control to
my_second_view's implementation
return my_second_view(request, parmsInADict)
def my_second_view(request, parmsFromFirstView=None):
# also look in the parmsFromFirstView dict, not just request.POST...
return render_to_response('results.html', ...)
If you MUST redirect in your situation, well nevermind, see the other
responses.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---