created the basic view and template for confirming participation in sage days anoop
authornishanth
Sat, 17 Jul 2010 01:01:29 +0530
branchanoop
changeset 120 f9408ab30ace
parent 118 6c3602582f9f
child 121 269ce2dfd428
created the basic view and template for confirming participation in sage days
sdi/site/urls.py
sdi/views.py
templates/cnf_sgd_ptc.html
--- a/sdi/site/urls.py	Sat Jul 17 00:26:16 2010 +0530
+++ b/sdi/site/urls.py	Sat Jul 17 01:01:29 2010 +0530
@@ -1,7 +1,7 @@
 from django.conf.urls.defaults import *
 
 from sage_days.sdi.views import register, reg_complete, list_stats, homepage, send_invi, admin_login, admin_logout
-from sage_days.sdi.views import send_workshop_confirm, confirm_wsp_participation, send_sagedays_confirm
+from sage_days.sdi.views import send_workshop_confirm, confirm_wsp_participation, send_sagedays_confirm, confirm_sgd_participation
 
 urlpatterns = patterns('',
 		       (r'^register/$', register),
@@ -13,5 +13,6 @@
                        (r'^send_wsp_cnf/$', send_workshop_confirm),
                        (r'^cnf_wsp_ptc/(\w+)/$', confirm_wsp_participation),
                        (r'^send_sgd_cnf/$', send_sagedays_confirm),
+                       (r'^cnf_sgd_ptc/(\w+)/$', confirm_sgd_participation),
                       )
 
--- 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.
     """
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/cnf_sgd_ptc.html	Sat Jul 17 01:01:29 2010 +0530
@@ -0,0 +1,17 @@
+{% extends 'base.html' %}
+{% block title %}
+Confirm Participation in Sage Days
+{% endblock %}
+{% block content %}
+Dear {{user}}, <br /> <br />
+Thank you for your interest in attending Sage Days.
+<br /> <br />
+There are just a few more details we would like to know.<br />
+Please fill the following details and confirm your participation.<br />
+<br />
+<form action="?email={{user.email}}" method=post>
+		{{form.as_p}}
+<input type=submit value="I confirm my participation in Sage Days 25" />
+</form>
+{% endblock %}
+