sdi/views.py
branchanoop
changeset 160 2f01af211af9
parent 159 f2f389e688fb
child 161 c7c5c727a483
equal deleted inserted replaced
159:f2f389e688fb 160:2f01af211af9
   119 def send_workshop_confirm(request):
   119 def send_workshop_confirm(request):
   120     """ Show a list of all the ppl who requested for a workshop and 
   120     """ Show a list of all the ppl who requested for a workshop and 
   121     send a confirmation mail to them if not sent.
   121     send a confirmation mail to them if not sent.
   122     """
   122     """
   123 
   123 
   124     matches = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="1")
   124     not_selected_ppl = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="1")
   125     if request.method == "POST":
   125     not_confirmed_ppl = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="2")
   126         form = UserSelectForm(matches, request.POST)
   126     attending_ppl = Registrant.objects.filter(need_for_python_workshop=True, registrantinfo__status_of_attending_workshop="3")
   127         if form.is_valid():
   127 
   128             selected_users = form.cleaned_data['selected_users']
   128     choices = list(not_selected_ppl) + list(not_confirmed_ppl)
   129             return render_to_response("sent_wsp_confirm.html", {"selected_users":selected_users})
   129     form = UserSelectForm(choices, request.POST)
   130         else:
   130     if request.method == "POST" and form.is_valid():
   131             return render_to_response("send_workshop_confirm.html", {"matches":matches})
   131         selected_users = form.cleaned_data['selected_users']
   132     else:
   132         for u in selected_users:
   133         return render_to_response("send_workshop_confirm.html", {"matches":matches}) 
   133             user_info = user.registrantinfo_set.all()[0]
       
   134             user_info.status_of_attending_workshop = "2"
       
   135             user_info.save()
       
   136 
       
   137         return render_to_response("sent_wsp_confirm.html", {"selected_users":selected_users})
       
   138     else:
       
   139         return render_to_response("send_wsp_cnf.html", {"attending": attending_ppl,
       
   140                                                         "not_confirmed": not_confirmed_ppl,
       
   141                                                         "not_selected": not_selected_ppl,})
   134 
   142 
   135 @login_required
   143 @login_required
   136 def send_sagedays_confirm(request):
   144 def send_sagedays_confirm(request):
   137     """ filter out ppl depending on their status and display accordingly.
   145     """ filter out ppl depending on their status and display accordingly.
   138     """
   146     """
   190                                                         "selected_not_confirmed":selected_not_confirmed_ppl,
   198                                                         "selected_not_confirmed":selected_not_confirmed_ppl,
   191                                                         "selected_confirmed":selected_confirmed_ppl,
   199                                                         "selected_confirmed":selected_confirmed_ppl,
   192                                                         "not_selected":not_selected_ppl,
   200                                                         "not_selected":not_selected_ppl,
   193                                                        })
   201                                                        })
   194 
   202 
   195 
       
   196 
       
   197 
       
   198 def confirm_wsp_participation(request, uid):
   203 def confirm_wsp_participation(request, uid):
   199     """ match id versus email and take lappy details.
   204     """ match id versus email and take lappy details.
   200     """
   205     """
   201 
   206 
   202     try:
   207     try: