sdi/views.py
branchanoop
changeset 120 f9408ab30ace
parent 118 6c3602582f9f
child 122 39cfefd9641c
--- a/sdi/views.py	Sat Jul 17 00:26:16 2010 +0530
+++ b/sdi/views.py	Sat Jul 17 01:01:29 2010 +0530
@@ -5,7 +5,7 @@
 
 from django.contrib.auth import authenticate, login, logout
 
-from sage_days.sdi.models import Registrant
+from sage_days.sdi.models import Registrant, RegistrantInfo, ParticipantInfo
 from sage_days.sdi.forms import RegisterForm, SearchForm, EmailForm, LoginForm, UserSelectForm
 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
@@ -188,6 +188,35 @@
     else:
         return render_to_response("cnf_wsp_ptc.html", {"user":user})
 
+def confirm_sgd_participation(request, uid):
+    """ match id versus email and take lappy details.
+    """
+
+    try:
+        email = request.GET['email']
+    except MultiValueDictKeyError:
+        raise Http404
+
+    try:
+        user = Registrant.objects.get(id=uid, email=email)
+    except Registrant.DoesNotExist:
+        raise Http404
+
+    user_info = user.registrantinfo_set.all()[0]
+    status = user_info.status_of_attending_sagedays
+    if status == "3":
+        return render_to_response("attending_sgd.html")
+    elif status != 2:
+        raise Http404
+
+    if request.method == "POST":
+        participant_info = ParticipantInfo()
+        participant_info.participant = user
+        participant_info.save()
+    else:
+        return render_to_response("cnf_sgd_ptc.html", {"user":user})
+
+
 def admin_login(request):
     """ basic login.
     """