django - Loading MultipleChoiceField initial values from session variables -


i'm trying pass list between 2 views , using session variables so.

def enrollmentverification(request):     session_enrollments = enrollment.objects.filter(id__in=request.session["enrollments"])     if request.method == 'post':         form = enrollmentverificationform(request.post)         if form.is_valid():             # doing stuff     else:         form = enrollmentverificationform(initial={'enrollments': session_enrollments})     return render_to_response("cup/enrollment_verification.html", {'form': form, 's_enrollments': session_enrollments}, context_instance=requestcontext(request)) 

rendering s_enrollmentsin list works in template, multiple selection widget empty. i've tried with:

form = enrollmentverificationform(initial={'enrollments': request.session["enrollments"]})

neither approach results in populated widget, if same data rendered list works fine. there's somewhere thinking twisted. ideas?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -