added the registrantinfo creation part in register view anoop
authornishanth
Sat, 17 Jul 2010 02:16:30 +0530
branchanoop
changeset 136 b68ff7095ca5
parent 135 f0bc4f5ee0ab
child 137 02a5304a2c5f
added the registrantinfo creation part in register view
sdi/views.py
--- a/sdi/views.py	Sat Jul 17 02:05:43 2010 +0530
+++ b/sdi/views.py	Sat Jul 17 02:16:30 2010 +0530
@@ -17,7 +17,7 @@
     if request.method == "POST":
         form = RegisterForm(request.POST)
         if form.is_valid():
-            form.save()
+            user = form.save()
 
             data = form.cleaned_data
             first_name = data['first_name']
@@ -25,6 +25,13 @@
             email = data['email']
             send_reg_complete_mail(email, first_name, last_name)
 
+            user_info = RegistrantInfo()
+            user_info.registrant = user
+            user_info.status_of_attending_sagedays = "1"
+            user_info.status_of_attending_workshop = True if user.need_for_python_workshop else False
+            user_info.status_of_accomodation = "1" if user.acco_required else "0"
+            user_info.save()
+
             return redirect("/sage_days/registration/complete")
         else:
             return render_to_response("register.html", {"form":form})