sdi/views.py
branchanoop
changeset 178 f87248c912b4
parent 176 faa42e8fa399
child 179 ac558619d49d
equal deleted inserted replaced
177:bbcf2a7d8b6b 178:f87248c912b4
   181     selected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   181     selected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   182                                                        registrantinfo__status_of_accomodation="3")
   182                                                        registrantinfo__status_of_accomodation="3")
   183     not_selected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   183     not_selected_ppl = Registrant.objects.filter(registrantinfo__status_of_attending_sagedays ="3", 
   184                                                  registrantinfo__status_of_accomodation="1")
   184                                                  registrantinfo__status_of_accomodation="1")
   185 
   185 
   186     user_choices = list(rejected_ppl) + list(selected_ppl) + list(not_selected_ppl)
   186     user_choices = list(rejected_ppl) + list(not_selected_ppl)
   187     form = UserSelectForm(user_choices, request.POST)
   187     form = UserSelectForm(user_choices, request.POST)
   188 
   188 
   189     if request.method == "POST" and form.is_valid():
   189     if request.method == "POST" and form.is_valid():
   190         selected_users = form.cleaned_data['selected_users']
   190         selected_users = form.cleaned_data['selected_users']
   191         for user in selected_users:
   191         for user in selected_users:
   192             user_info = user.registrantinfo_set.all()[0]
   192             user_info = user.registrantinfo_set.all()[0]
   193             user_info.status_of_accomodation = "2"
   193             user_info.status_of_accomodation = "2"
   194             user_info.save()
   194             user_info.save()
       
   195 
       
   196 	    message = form.cleaned_data['message']
   195         
   197         
   196         return render_to_response("sent_acco_confirm.html", {"selected_users":selected_users})
   198         return render_to_response("sent_acco_confirm.html", {"selected_users":selected_users})
   197     else:
   199     else:
   198         return render_to_response("send_acco_cnf.html", {"rejected": rejected_ppl,
   200         return render_to_response("send_acco_cnf.html", {"rejected": rejected_ppl,
   199                                                         "selected":selected_ppl,
   201                                                         "selected":selected_ppl,