sdi/views.py
branchanoop
changeset 214 e76c56790872
parent 211 a098e677b5a0
child 223 b67b2d5cfdd8
equal deleted inserted replaced
213:ffe5ef840fde 214:e76c56790872
   174 def send_acco_confirm(request):
   174 def send_acco_confirm(request):
   175     """ display list of confirmed participants who requested for accomodation
   175     """ display list of confirmed participants who requested for accomodation
   176     and let the admin decide.
   176     and let the admin decide.
   177     """
   177     """
   178 
   178 
   179     rejected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   179     rejected_ppl = Registrant.objects.filter(
   180                                              registrantinfo__status_of_accomodation="4")
   180         registrantinfo__status_of_attending_sagedays ="3", 
   181     selected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   181         registrantinfo__status_of_accomodation="3")
   182                                                        registrantinfo__status_of_accomodation="3")
   182     selected_ppl = Registrant.objects.filter(
   183     not_selected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   183         registrantinfo__status_of_attending_sagedays ="3", 
   184                                                  registrantinfo__status_of_accomodation="1")
   184         registrantinfo__status_of_accomodation="2")
       
   185     not_selected_ppl = Registrant.objects.filter(
       
   186         registrantinfo__status_of_attending_sagedays ="3", 
       
   187         registrantinfo__status_of_accomodation="1")
   185 
   188 
   186     user_choices = list(rejected_ppl) + list(not_selected_ppl)
   189     user_choices = list(rejected_ppl) + list(not_selected_ppl)
   187     form = SendAccoForm(user_choices, request.POST)
   190     form = SendAccoForm(user_choices, request.POST)
   188 
   191 
   189     if request.method == "POST" and form.is_valid():
   192     if request.method == "POST" and form.is_valid():
   191         message = form.cleaned_data['message']
   194         message = form.cleaned_data['message']
   192         for user in selected_users:
   195         for user in selected_users:
   193             user_info = user.registrantinfo_set.all()[0]
   196             user_info = user.registrantinfo_set.all()[0]
   194             user_info.status_of_accomodation = "3"
   197             user_info.status_of_accomodation = "3"
   195             user_info.save()
   198             user_info.save()
   196 	
   199 
   197 	    send_acco_confirm_mail(user, message)
   200         send_acco_confirm_mail(user, message)
   198         
   201 
   199         return render_to_response("sent_acco_confirm.html", {"selected_users":selected_users})
   202         return render_to_response("sent_acco_confirm.html",
   200     else:
   203                                   {"selected_users":selected_users})
   201         return render_to_response("send_acco_cnf.html", {"rejected": rejected_ppl,
   204     else:
   202                                                         "selected":selected_ppl,
   205         return render_to_response("send_acco_cnf.html",
   203                                                         "not_selected":not_selected_ppl,
   206                                   {"rejected": rejected_ppl,
   204                                                        })
   207                                    "selected":selected_ppl,
       
   208                                    "not_selected":not_selected_ppl,
       
   209                                   })
   205 
   210 
   206 def confirm_wsp_participation(request, uid):
   211 def confirm_wsp_participation(request, uid):
   207     """ match id versus email and take lappy details.
   212     """ match id versus email and take lappy details.
   208     """
   213     """
   209     return render_to_response("workshop_info.html")
   214     return render_to_response("workshop_info.html")