# HG changeset patch # User nishanth # Date 1279807464 -19800 # Node ID 2f01af211af9d9a241e8bb2dc33b924f68c8af04 # Parent f2f389e688fb850f8324ffc79bc8d9d6f88baf2b updated the view to look like send_sgd_cnf diff -r f2f389e688fb -r 2f01af211af9 sdi/views.py --- a/sdi/views.py Wed Jul 21 17:37:52 2010 +0530 +++ b/sdi/views.py Thu Jul 22 19:34:24 2010 +0530 @@ -121,16 +121,24 @@ send a confirmation mail to them if not sent. """ - matches = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="1") - if request.method == "POST": - form = UserSelectForm(matches, request.POST) - if form.is_valid(): - selected_users = form.cleaned_data['selected_users'] - return render_to_response("sent_wsp_confirm.html", {"selected_users":selected_users}) - else: - return render_to_response("send_workshop_confirm.html", {"matches":matches}) + not_selected_ppl = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="1") + not_confirmed_ppl = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="2") + attending_ppl = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="3") + + choices = list(not_selected_ppl) + list(not_confirmed_ppl) + form = UserSelectForm(choices, request.POST) + if request.method == "POST" and form.is_valid(): + selected_users = form.cleaned_data['selected_users'] + for u in selected_users: + user_info = user.registrantinfo_set.all()[0] + user_info.status_of_attending_workshop = "2" + user_info.save() + + return render_to_response("sent_wsp_confirm.html", {"selected_users":selected_users}) else: - return render_to_response("send_workshop_confirm.html", {"matches":matches}) + return render_to_response("send_wsp_cnf.html", {"attending": attending_ppl, + "not_confirmed": not_confirmed_ppl, + "not_selected": not_selected_ppl,}) @login_required def send_sagedays_confirm(request): @@ -192,9 +200,6 @@ "not_selected":not_selected_ppl, }) - - - def confirm_wsp_participation(request, uid): """ match id versus email and take lappy details. """