author | Madhusudan.C.S <madhusudancs@gmail.com> |
Wed, 21 Jul 2010 17:02:10 +0530 | |
changeset 146 | e23e937ddcda |
parent 142 | 70fcb57d8d15 |
child 186 | 8bd09b59f359 |
permissions | -rw-r--r-- |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
1 |
from django.contrib.auth import authenticate |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
2 |
from django.contrib.auth import login |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
from django.contrib.auth.decorators import login_required |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
4 |
from django.contrib.auth.forms import AuthenticationForm |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
5 |
from django.contrib.auth.models import User |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
6 |
from django.core.exceptions import ObjectDoesNotExist |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
7 |
from django.core.urlresolvers import reverse |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
8 |
from django.shortcuts import render_to_response |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
9 |
from django.template import RequestContext |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
11 |
from project.scipycon.base.models import Event |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
12 |
from project.scipycon.registration.forms import RegistrationEditForm |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
13 |
from project.scipycon.registration.forms import RegistrationSubmitForm |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
14 |
from project.scipycon.registration.forms import WifiForm |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
15 |
from project.scipycon.registration.models import Registration |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
16 |
from project.scipycon.registration.models import Wifi |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
17 |
from project.scipycon.registration.utils import send_confirmation |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
18 |
from project.scipycon.user.forms import RegistrantForm |
96
178b89a3ca4f
Removed unwanted files and made more changes to make SciPyCon a clean app.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
94
diff
changeset
|
19 |
from project.scipycon.user.models import UserProfile |
178b89a3ca4f
Removed unwanted files and made more changes to make SciPyCon a clean app.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
94
diff
changeset
|
20 |
from project.scipycon.user.utils import scipycon_createregistrant |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
21 |
from project.scipycon.utils import set_message_cookie |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
22 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
23 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
REG_TOTAL = 1000 |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
|
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
26 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
27 |
@login_required |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
28 |
def registrations(request, scope, |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
29 |
template_name='registration/registrations.html'): |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
30 |
"""Simple page to count registrations""" |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
31 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
32 |
registrations = Registration.objects.all().count() |
142
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
33 |
|
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
34 |
user = request.user |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
35 |
if user.is_authenticated(): |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
36 |
registration = Registration.objects.get(registrant=user) |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
37 |
else: |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
38 |
registration = None |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
39 |
|
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
40 |
event = Event.objects.get(scope=scope) |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
41 |
|
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
42 |
return render_to_response(template_name, RequestContext(request, { |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
43 |
'params': {'scope': scope}, |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
'over_reg' : registrations >= REG_TOTAL and True or False, |
142
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
45 |
'registrations' : registrations, |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
46 |
'registration': registration, |
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
47 |
'event': event})) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
48 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
49 |
@login_required |
111
0e2c94c6a9e8
Adjusted views to send the scope in params.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
106
diff
changeset
|
50 |
def edit_registration(request, scope, id, |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
51 |
template_name='registration/edit-registration.html'): |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
52 |
"""Allows users that submitted a registration to edit it. |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
53 |
""" |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
54 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
reg = Registration.objects.get(pk=id) |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
56 |
wifi = Wifi.objects.get(user=reg.registrant) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
if reg.registrant != request.user: |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
59 |
redirect_to = reverse('scipycon_account', kwargs={'scope': scope}) |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
60 |
|
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
61 |
return set_message_cookie( |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
62 |
redirect_to, |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
63 |
msg = u'Redirected because the registration you selected' \ |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
+ ' is not your own.') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
65 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
66 |
if request.method == 'POST': |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
67 |
registration_form = RegistrationEditForm(data=request.POST) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
68 |
wifi_form = WifiForm(data=request.POST) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
69 |
|
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
70 |
if registration_form.is_valid() and wifi_form.is_valid(): |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
71 |
reg.organisation = registration_form.data.get('organisation') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
72 |
reg.occupation = registration_form.data.get('occupation') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
73 |
reg.city = registration_form.data.get('city') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
74 |
reg.phone_num = registration_form.data.get('phone_num') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
75 |
reg.postcode = registration_form.data.get('postcode') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
76 |
#reg.tshirt = registration_form.data.get('tshirt') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
77 |
reg.allow_contact = registration_form.data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
78 |
'allow_contact') and True or False |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
79 |
reg.conference = registration_form.data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
80 |
'conference') and True or False |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
81 |
reg.tutorial = registration_form.data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
82 |
'tutorial') and True or False |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
83 |
reg.sprint = registration_form.data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
84 |
'sprint') and True or False |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
85 |
reg.save() |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
86 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
87 |
wifi = wifi_form.save(reg.registrant, reg.scope) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
88 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
89 |
# Saved.. redirect |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
90 |
redirect_to = reverse('scipycon_account', kwargs={'scope': scope}) |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
91 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
92 |
return set_message_cookie(redirect_to, |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
93 |
msg = u'Your changes have been saved.') |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
94 |
else: |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
95 |
import logging |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
96 |
logging.error(registration_form.data) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
97 |
raise "Bow Bow" |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
98 |
else: |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
99 |
registration_form = RegistrationEditForm(initial={ |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
100 |
'id' : id, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
101 |
'organisation' : reg.organisation, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
102 |
'occupation' : reg.occupation, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
103 |
'city' : reg.city, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
104 |
'phone_num': reg.phone_num, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
105 |
#'tshirt' : reg.tshirt, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
106 |
'conference': reg.conference, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
107 |
'tutorial': reg.tutorial, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
108 |
'postcode' : reg.postcode, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
109 |
'sprint' : reg.sprint, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
110 |
'allow_contact' : reg.allow_contact, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
111 |
}) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
112 |
wifi_form = WifiForm(initial={ |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
113 |
'user': wifi.user, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
114 |
'scope': wifi.scope, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
115 |
'wifi': wifi.wifi |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
116 |
}) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
117 |
|
111
0e2c94c6a9e8
Adjusted views to send the scope in params.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
106
diff
changeset
|
118 |
return render_to_response( |
0e2c94c6a9e8
Adjusted views to send the scope in params.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
106
diff
changeset
|
119 |
template_name, RequestContext(request, { |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
120 |
'params': {'scope': scope}, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
121 |
'registration': {'id': id}, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
122 |
'registration_form': registration_form, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
123 |
'wifi_form': wifi_form})) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
124 |
|
106
3a31881564ba
Add a scope pattern to the URLs.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
125 |
def submit_registration(request, scope, |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
126 |
template_name='registration/submit-registration.html'): |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
127 |
"""Allows user to edit registration |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
128 |
""" |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
129 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
130 |
user = request.user |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
131 |
reg_count = Registration.objects.all().count() |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
132 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
133 |
scope_entity = Event.objects.get(scope=scope) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
134 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
135 |
if user.is_authenticated(): |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
136 |
try: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
137 |
profile = user.get_profile() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
138 |
except: |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
139 |
profile, new = UserProfile.objects.get_or_create( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
140 |
user=user, scope=scope_entity) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
141 |
if new: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
142 |
profile.save() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
143 |
try: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
144 |
registration = Registration.objects.get(registrant=user) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
145 |
if registration: |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
146 |
redirect_to = reverse('scipycon_account', |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
147 |
kwargs={'scope': scope}) |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
148 |
return set_message_cookie( |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
149 |
redirect_to, msg = u'You have already been registered.') |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
150 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
151 |
except ObjectDoesNotExist: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
152 |
pass |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
153 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
154 |
message = None |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
155 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
156 |
if request.method == 'POST': |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
157 |
registration_form = RegistrationSubmitForm(data=request.POST) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
158 |
registrant_form = RegistrantForm(data=request.POST) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
159 |
wifi_form = WifiForm(data=request.POST) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
160 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
161 |
if request.POST.get('action', None) == 'login': |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
162 |
login_form = AuthenticationForm(data=request.POST) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
163 |
if login_form.is_valid(): |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
164 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
165 |
login(request, login_form.get_user()) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
166 |
|
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
167 |
redirect_to = reverse('scipycon_submit_registration', |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
168 |
kwargs={'scope': scope}) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
169 |
return set_message_cookie(redirect_to, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
170 |
msg = u'You have been logged in please continue' + \ |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
171 |
'with registration.') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
172 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
173 |
newuser = None |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
174 |
passwd = None |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
175 |
if not user.is_authenticated(): |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
176 |
if registrant_form.is_valid(): |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
177 |
newuser = scipycon_createregistrant( |
142
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
178 |
request, registrant_form.data, scope) |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
179 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
180 |
# Log in user |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
181 |
passwd = User.objects.make_random_password() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
182 |
newuser.set_password(passwd) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
183 |
newuser.save() |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
184 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
185 |
user = authenticate(username=newuser.username, password=passwd) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
186 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
187 |
login(request, user) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
188 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
189 |
newuser = user |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
190 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
191 |
else: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
192 |
newuser = user |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
193 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
194 |
if registration_form.is_valid() and newuser and wifi_form.is_valid(): |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
195 |
allow_contact = registration_form.cleaned_data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
196 |
'allow_contact') and True or False |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
197 |
conference = registration_form.cleaned_data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
198 |
'conference') and True or False |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
199 |
tutorial = registration_form.cleaned_data.get('tutorial') and \ |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
200 |
True or False |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
201 |
sprint = registration_form.cleaned_data.get('sprint') and \ |
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
202 |
True or False |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
203 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
204 |
registrant = User.objects.get(pk=newuser.id) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
205 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
206 |
reg = Registration( |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
207 |
scope=scope_entity, |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
208 |
registrant = registrant, |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
209 |
organisation = registration_form.cleaned_data.get( |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
210 |
'organisation'), |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
211 |
occupation = registration_form.cleaned_data.get('occupation'), |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
212 |
city = registration_form.cleaned_data.get('city'), |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
213 |
#tshirt = registration_form.data.get('tshirt'), |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
214 |
postcode = registration_form.cleaned_data.get('postcode'), |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
215 |
phone_num = registration_form.cleaned_data.get('phone_num'), |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
216 |
allow_contact = allow_contact, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
217 |
conference = conference, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
218 |
tutorial = tutorial, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
219 |
sprint = sprint) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
220 |
reg.save() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
221 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
222 |
# get id and use as slug and invoice number |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
223 |
id = reg.id |
142
70fcb57d8d15
Added event and registrants to Registration summary page.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
224 |
slug = 'SCIPYIN2010%04d' % id |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
225 |
reg.slug = slug |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
226 |
reg.save() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
227 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
228 |
wifi = wifi_form.save(registrant, scope_entity) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
126
diff
changeset
|
229 |
|
146
e23e937ddcda
Removed unwanted mail texts and made the texts scope compliant.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
142
diff
changeset
|
230 |
send_confirmation(registrant, scope_entity) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
231 |
|
126
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
232 |
redirect_to = reverse('scipycon_registrations', |
f185cb8316cf
Added scope to all URLs, all reverse functions and all view methods and removed unnecessary functions.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
111
diff
changeset
|
233 |
kwargs={'scope': scope}) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
234 |
return set_message_cookie(redirect_to, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
235 |
msg = u'Thank you, your registration has been submitted '\ |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
236 |
'and an email has been sent with payment details.') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
237 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
238 |
else: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
239 |
registration_form = RegistrationSubmitForm() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
240 |
registrant_form = RegistrantForm() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
241 |
wifi_form = WifiForm() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
242 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
243 |
login_form = AuthenticationForm() |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
244 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
245 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
246 |
return render_to_response(template_name, RequestContext(request, { |
111
0e2c94c6a9e8
Adjusted views to send the scope in params.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
106
diff
changeset
|
247 |
'params': {'scope': scope}, |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
248 |
'registration_form': registration_form, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
249 |
'registrant_form' : registrant_form, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
250 |
'over_reg' : reg_count >= REG_TOTAL and True or False, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
251 |
'wifi_form' : wifi_form, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
252 |
'message' : message, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
253 |
'login_form' : login_form |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
254 |
})) |