author | Madhusudan.C.S <madhusudancs@gmail.com> |
Mon, 08 Nov 2010 00:48:28 +0530 | |
changeset 199 | 97cbeda302a9 |
parent 191 | 0eb941d14ec3 |
child 246 | 1bd29275df1f |
child 272 | 4801b7adbbc5 |
permissions | -rw-r--r-- |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
1 |
from django import forms |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
2 |
from django.core.exceptions import ObjectDoesNotExist |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
3 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
4 |
from project.scipycon.registration.models import SIZE_CHOICES |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
5 |
from project.scipycon.registration.models import OCCUPATION_CHOICES |
199
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
6 |
from project.scipycon.registration.models import Accommodation |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
7 |
from project.scipycon.registration.models import Wifi |
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
|
8 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
9 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
10 |
class RegistrationSubmitForm(forms.Form): |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
11 |
"""SciPyCon registration form |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
12 |
""" |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
13 |
#tshirt = forms.ChoiceField(choices=SIZE_CHOICES, required=True, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
14 |
# label=u'T-shirt size', help_text=u'Yes, we all get a t-shirt!') |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
15 |
organisation = forms.CharField(required=True, label=u'Organisation', |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
16 |
help_text=u'The primary organisation that you are a member of.', |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
17 |
max_length=255, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
18 |
widget=forms.TextInput(attrs={'size':'50'})) |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
19 |
occupation = forms.ChoiceField(choices=OCCUPATION_CHOICES, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
20 |
required=True, label=u'Occupation', |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
21 |
help_text=u'Title of your occupation') |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
22 |
city = forms.CharField(required=False, label=u'City', |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
23 |
help_text=u'Your city of residence', |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
24 |
max_length=255, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
25 |
widget=forms.TextInput(attrs={'size':'50'})) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
26 |
postcode = forms.CharField(required=False, label=u'Postcode', |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
27 |
help_text=u'PIN Code of your area', |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
28 |
max_length=10, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
29 |
widget=forms.TextInput(attrs={'size':'10'})) |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
30 |
phone_num = forms.CharField(required=False, label=u'Phone Number', |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
31 |
help_text=u'Phone number. Although optional, please provide it for ' |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
32 |
'faster correspondence', max_length=14, |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
33 |
widget=forms.TextInput(attrs={'size':'20'})) |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
34 |
allow_contact = forms.BooleanField(required=False, label=u'Contact', |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
35 |
help_text=u'May organizers of SciPy.in contact you after the event?') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
36 |
conference = forms.BooleanField(required=False, label=u'Conference', |
191
0eb941d14ec3
Changing the fee details in the registration form to the link.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
137
diff
changeset
|
37 |
help_text=u"""Do you intend to attend SciPy.in 2010 conference?""") |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
38 |
tutorial = forms.BooleanField(required=False, label=u'Tutorial', |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
39 |
help_text=u'Do you intend to attend the tutorials?') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
40 |
sprint = forms.BooleanField(required=False, label=u'Sprint', |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
41 |
help_text=u'Do you intend to attend the sprints?') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
42 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
43 |
def occupation_fields(self): |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
44 |
return (self['organisation'], |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
45 |
self['occupation']) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
46 |
|
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
47 |
def demographic_fields(self): |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
48 |
return (self['city'], |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
49 |
self['postcode'], |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
50 |
self['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
|
51 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
52 |
def personal_fields(self): |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
53 |
return (#self['tshirt'], |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
54 |
self['conference'], |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
55 |
self['tutorial'], |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
56 |
self['sprint'], |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
57 |
self['allow_contact']) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
58 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
59 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
60 |
class RegistrationEditForm(RegistrationSubmitForm): |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
61 |
id = forms.CharField(widget=forms.HiddenInput) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
62 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
63 |
class WifiForm(forms.ModelForm): |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
64 |
"""PyCon wifi form |
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 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
67 |
def save(self, user, scope): |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
68 |
try: |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
69 |
wifi = Wifi.objects.get(user=user, scope=scope) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
70 |
except ObjectDoesNotExist: |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
71 |
wifi = Wifi(user=user, scope=scope) |
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
72 |
|
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
73 |
wifi.wifi = self.cleaned_data['wifi'] |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
74 |
wifi.save() |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
75 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
76 |
return wifi |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
77 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
78 |
class Meta: |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
79 |
model = Wifi |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
80 |
fields = ('wifi',) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
81 |
|
199
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
82 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
83 |
class AccommodationForm(forms.ModelForm): |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
84 |
"""PyCon Accommodation form |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
85 |
""" |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
86 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
87 |
def save(self, user, scope): |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
88 |
try: |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
89 |
acco = Accommodation.objects.get(user=user, scope=scope) |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
90 |
except ObjectDoesNotExist: |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
91 |
acco = Accommodation(user=user, scope=scope) |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
92 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
93 |
sex = self.cleaned_data['sex'] |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
94 |
accommodation_required = self.cleaned_data['accommodation_required'] |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
95 |
accommodation_days = self.cleaned_data['accommodation_days'] |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
96 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
97 |
acco.sex = sex |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
98 |
acco.accommodation_required = accommodation_required |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
99 |
acco.accommodation_days = accommodation_days if ( |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
100 |
accommodation_days) else 0 |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
101 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
102 |
acco.save() |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
103 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
104 |
return acco |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
105 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
106 |
def clean(self): |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
107 |
"""Makes sure that accommodation form is correct, i.e. sex |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
108 |
and number of days required are filled in when the accommodation |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
109 |
is required. |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
110 |
""" |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
111 |
cleaned = self.cleaned_data |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
112 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
113 |
sex = self.cleaned_data['sex'] |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
114 |
accommodation_required = self.cleaned_data['accommodation_required'] |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
115 |
accommodation_days = self.cleaned_data['accommodation_days'] |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
116 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
117 |
if accommodation_required and (not sex or not accommodation_days |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
118 |
or accommodation_days == 0): |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
119 |
raise forms.ValidationError( |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
120 |
u"If accommodation is required both gender and number of " |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
121 |
"days for which accommodation is required is mandatory.") |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
122 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
123 |
return super(AccommodationForm, self).clean() |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
124 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
125 |
class Meta: |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
126 |
model = Accommodation |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
127 |
fields = ('accommodation_required', 'sex', 'accommodation_days') |
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
diff
changeset
|
128 |
|
97cbeda302a9
Added accommodation Django form, wrote the save method and overwrote the cleaner.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
191
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 |
PC = ( |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
131 |
('all', 'all'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
132 |
('paid', 'paid'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
133 |
('not paid', 'not paid') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
134 |
) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
135 |
HC = ( |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
136 |
('all', 'all'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
137 |
('party', 'party'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
138 |
('no party', 'no party') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
139 |
) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
140 |
AC = ( |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
141 |
('all', 'all'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
142 |
('0', '0'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
143 |
('10', '10'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
144 |
('20', '20'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
145 |
('40', '40'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
146 |
) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
147 |
OC = ( |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
148 |
('email', 'email'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
149 |
('amount', 'amount'), |
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 |
|
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
152 |
IC = ( |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
153 |
('Name', 'name'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
154 |
('Email', 'email'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
155 |
('Amount', 'amount'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
156 |
('Organisation', 'organisation'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
157 |
('Conference', 'conference'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
158 |
('Tutorial', 'tutorial'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
159 |
('Sprint', 'sprint'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
160 |
('T-size', 'tshirt'), |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
161 |
) |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
162 |
|
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
163 |
|
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
164 |
class RegistrationAdminSelectForm(forms.Form): |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
165 |
""" |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
166 |
Used to make selection for csv download |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
167 |
""" |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
168 |
by_payment = forms.ChoiceField(choices=PC, required=False, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
169 |
label=u'By payment') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
170 |
by_amount = forms.MultipleChoiceField(choices=AC, required=False, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
171 |
label=u'By amount') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
172 |
by_party = forms.ChoiceField(choices=HC, required=False, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
173 |
label=u'by party') |
137
ec6e58c639bf
Added phone number, modified Occupation to be choice field.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
96
diff
changeset
|
174 |
by_tshirt = forms.ChoiceField(choices=SIZE_CHOICES, required=False, |
94
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
175 |
label=u'by tshirt size') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
176 |
order_by = forms.ChoiceField(choices=OC, required=False, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
177 |
label=u'order results') |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
178 |
include = forms.MultipleChoiceField(choices=IC, required=False, |
87e77aa18610
Moved the files to new Django app named scipycon and modified settings.
Madhusudan.C.S <madhusudancs@gmail.com>
parents:
diff
changeset
|
179 |
label=u'Include fields') |