97 |
97 |
98 a1 = self.cleaned_data['accommodation_on_1st'] |
98 a1 = self.cleaned_data['accommodation_on_1st'] |
99 a2 = self.cleaned_data['accommodation_on_2nd'] |
99 a2 = self.cleaned_data['accommodation_on_2nd'] |
100 a3 = self.cleaned_data['accommodation_on_3rd'] |
100 a3 = self.cleaned_data['accommodation_on_3rd'] |
101 a4 = self.cleaned_data['accommodation_on_4th'] |
101 a4 = self.cleaned_data['accommodation_on_4th'] |
102 a5 = self.cleaned_data['accommodation_on_5th'] |
102 |
103 a6 = self.cleaned_data['accommodation_on_6th'] |
103 |
104 |
104 accommodation_days = [a1, a2, a3, a4].count(True) |
105 accommodation_days = [a1, a2, a3, a4, a5, a6].count(True) |
|
106 |
105 |
107 acco.sex = sex |
106 acco.sex = sex |
108 acco.accommodation_required = accommodation_required |
107 acco.accommodation_required = accommodation_required |
109 acco.accommodation_days = accommodation_days |
108 acco.accommodation_days = accommodation_days |
110 |
109 |
111 acco.accommodation_on_1st = a1 |
110 acco.accommodation_on_1st = a1 |
112 acco.accommodation_on_2nd = a2 |
111 acco.accommodation_on_2nd = a2 |
113 acco.accommodation_on_3rd = a3 |
112 acco.accommodation_on_3rd = a3 |
114 acco.accommodation_on_4th = a4 |
113 acco.accommodation_on_4th = a4 |
115 acco.accommodation_on_5th = a5 |
|
116 acco.accommodation_on_6th = a6 |
|
117 |
114 |
118 |
115 |
119 acco.save() |
116 acco.save() |
120 |
117 |
121 return acco |
118 return acco |
132 |
129 |
133 a1 = self.cleaned_data['accommodation_on_1st'] |
130 a1 = self.cleaned_data['accommodation_on_1st'] |
134 a2 = self.cleaned_data['accommodation_on_2nd'] |
131 a2 = self.cleaned_data['accommodation_on_2nd'] |
135 a3 = self.cleaned_data['accommodation_on_3rd'] |
132 a3 = self.cleaned_data['accommodation_on_3rd'] |
136 a4 = self.cleaned_data['accommodation_on_4th'] |
133 a4 = self.cleaned_data['accommodation_on_4th'] |
137 a5 = self.cleaned_data['accommodation_on_5th'] |
134 |
138 a6 = self.cleaned_data['accommodation_on_6th'] |
135 selected_a_date = any([a1, a2, a3, a4]) |
139 |
|
140 selected_a_date = any([a1, a2, a3, a4, a5, a6]) |
|
141 |
136 |
142 if accommodation_required and (not sex or not selected_a_date): |
137 if accommodation_required and (not sex or not selected_a_date): |
143 #or accommodation_days == 0): |
138 #or accommodation_days == 0): |
144 raise forms.ValidationError( |
139 raise forms.ValidationError( |
145 u"If accommodation is required please specify gender and" |
140 u"If accommodation is required please specify gender and" |
153 'sex', |
148 'sex', |
154 'accommodation_on_1st', |
149 'accommodation_on_1st', |
155 'accommodation_on_2nd', |
150 'accommodation_on_2nd', |
156 'accommodation_on_3rd', |
151 'accommodation_on_3rd', |
157 'accommodation_on_4th', |
152 'accommodation_on_4th', |
158 'accommodation_on_5th', |
|
159 'accommodation_on_6th', |
|
160 ) |
153 ) |
161 |
154 |
162 |
155 |
163 class PaymentForm(forms.ModelForm): |
156 class PaymentForm(forms.ModelForm): |
164 """SciPyCon Payment form |
157 """SciPyCon Payment form |