PSSR
PSSR

Reputation: 469

Django How to pass list of values one views function to other views function

I want pass list of values from with in the views with HttpResponseRedirect. I don't want session variables. How can I do this functions are as follows.

def fun_one(request):
        x = [a,b,c,d]
    y = [1,2,3,4]
    return HttpResponseRedirect('/fun_two/')
def fun_two(request):
    .
    .
    .
    print "i want use function One values x & y here"

Upvotes: 0

Views: 800

Answers (1)

Bibhas Debnath
Bibhas Debnath

Reputation: 14939

If you Must use HttpResponseRedirect, one way would be to pass the values as GET parameters -

return HttpResponseRedirect('/fun_two/?y=1,2,3,4')

And reading them back with request.GET.get('y') and then just split(',').

Upvotes: 2

Related Questions