# HG changeset patch # User nishanth # Date 1279308689 -19800 # Node ID f9408ab30ace2fe68d04678499422c8a2761287e # Parent 6c3602582f9f97b89211358847dec78bf66d6d79 created the basic view and template for confirming participation in sage days diff -r 6c3602582f9f -r f9408ab30ace sdi/site/urls.py --- 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), ) diff -r 6c3602582f9f -r f9408ab30ace sdi/views.py --- 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. """ diff -r 6c3602582f9f -r f9408ab30ace templates/cnf_sgd_ptc.html --- /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}},

+Thank you for your interest in attending Sage Days. +

+There are just a few more details we would like to know.
+Please fill the following details and confirm your participation.
+
+
+ {{form.as_p}} + +
+{% endblock %} +