[Fixed]-Pass lists from one view to another in Django

1👍

Save ids of the Question objects in the session and get objects from DB in second view again.

def javaindex(request):
    ...
    request.session['jlist'] = [j.id for j in jlist]
    ...

def javaresult(request):
    ...
    jlist = Question.objects.filter(id__in=request.session['jlist'])
    ...

Leave a comment