Skip to content Skip to sidebar Skip to footer

How To Pass A List Between Views In Django

I have a list in one view that I would like to pass to another view to be parsed. This is what I currently have. The views: def view1(request): if request.method=='POST':

Solution 1:

As Brandon suggested, posting to the second view was a usable solution. Something along the lines of:

defview2(request):
    if request.method == 'POST':
        page_list=request.POST.values()
    else:
        HttpResponseRedirect('/urls/')

and then no need for regex in the urls

Solution 2:

I would like the number of objects selected to not be finite or limited but that may not be an option.

It definitely is an option. Capture everything post the certain word as a single reg-ex and parse it to different "tags" within your view.

Post a Comment for "How To Pass A List Between Views In Django"