created a form for taking participant info and used it in the view anoop
authornishanth
Sat, 17 Jul 2010 01:14:36 +0530
branchanoop
changeset 124 d4a7644e7fe8
parent 123 dd1a4022d5b1
child 125 92f77f8428e7
created a form for taking participant info and used it in the view
sdi/forms.py
sdi/views.py
--- a/sdi/forms.py	Sat Jul 17 01:08:40 2010 +0530
+++ b/sdi/forms.py	Sat Jul 17 01:14:36 2010 +0530
@@ -1,7 +1,7 @@
 from django import forms
 from django.contrib.auth import authenticate
 
-from sage_days.sdi.models import Registrant, TOPICS_CHOICES
+from sage_days.sdi.models import Registrant, TOPICS_CHOICES, ParticipantInfo
 from captcha.fields import CaptchaField
 
 class RegisterForm(forms.ModelForm):
@@ -181,3 +181,8 @@
 
     return myF(post_data) if post_data else myF()
 
+class ParticipantInfoForm(forms.ModelForm):
+
+    class Meta:
+        model = ParticipantInfo
+        exclude = ['participant']
--- a/sdi/views.py	Sat Jul 17 01:08:40 2010 +0530
+++ b/sdi/views.py	Sat Jul 17 01:14:36 2010 +0530
@@ -6,7 +6,7 @@
 from django.contrib.auth import authenticate, login, logout
 
 from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo
-from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm
+from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm, ParticipantInfoForm
 from sage_days.sdi.events import send_reg_complete_mail, mail_invi, send_wsp_ptc_confirm
 from sage_days.settings import APACHE_URL_PREFIX as aup
 
@@ -209,11 +209,13 @@
     elif status != "2":
         raise Http404
 
+    participant_info = ParticipantInfo()
+    participant_info.participant = user
+
     if request.method == "POST":
-        participant_info = ParticipantInfo()
-        participant_info.participant = user
-        participant_info.save()
+        pass
     else:
+        form = ParticipantInfoForm(instance=participant_info)
         return render_to_response("cnf_sgd_ptc.html", {"user":user})