94 |
94 |
95 sex = self.cleaned_data['sex'] |
95 sex = self.cleaned_data['sex'] |
96 accommodation_required = self.cleaned_data['accommodation_required'] |
96 accommodation_required = self.cleaned_data['accommodation_required'] |
97 accommodation_days = sum(filter([a1, a2, a3, a4, a5, a6])) |
97 accommodation_days = sum(filter([a1, a2, a3, a4, a5, a6])) |
98 |
98 |
99 a1 = self.cleaned_data['accomodation_on_1st'] |
99 a1 = self.cleaned_data['accommodation_on_1st'] |
100 a2 = self.cleaned_data['accomodation_on_2nd'] |
100 a2 = self.cleaned_data['accommodation_on_2nd'] |
101 a3 = self.cleaned_data['accomodation_on_3rd'] |
101 a3 = self.cleaned_data['accommodation_on_3rd'] |
102 a4 = self.cleaned_data['accomodation_on_4th'] |
102 a4 = self.cleaned_data['accommodation_on_4th'] |
103 a5 = self.cleaned_data['accomodation_on_5th'] |
103 a5 = self.cleaned_data['accommodation_on_5th'] |
104 a6 = self.cleaned_data['accomodation_on_6th'] |
104 a6 = self.cleaned_data['accommodation_on_6th'] |
105 |
105 |
106 acco.sex = sex |
106 acco.sex = sex |
107 acco.accommodation_required = accommodation_required |
107 acco.accommodation_required = accommodation_required |
108 acco.accommodation_days = accomodation_days |
108 acco.accommodation_days = _days |
109 |
109 |
110 acco.accomodation_on_1st = a1 |
110 acco._on_1st = a1 |
111 acco.accomodation_on_2nd = a2 |
111 acco._on_2nd = a2 |
112 acco.accomodation_on_3rd = a3 |
112 acco._on_3rd = a3 |
113 acco.accomodation_on_4th = a4 |
113 acco._on_4th = a4 |
114 acco.accomodation_on_5th = a5 |
114 acco._on_5th = a5 |
115 acco.accomodation_on_6th = a6 |
115 acco._on_6th = a6 |
116 |
116 |
117 |
117 |
118 acco.save() |
118 acco.save() |
119 |
119 |
120 return acco |
120 return acco |
127 cleaned = self.cleaned_data |
127 cleaned = self.cleaned_data |
128 |
128 |
129 sex = self.cleaned_data['sex'] |
129 sex = self.cleaned_data['sex'] |
130 accommodation_required = self.cleaned_data['accommodation_required'] |
130 accommodation_required = self.cleaned_data['accommodation_required'] |
131 |
131 |
132 a1 = self.cleaned_data['accomodation_on_1st'] |
132 a1 = self.cleaned_data['_on_1st'] |
133 a2 = self.cleaned_data['accomodation_on_2nd'] |
133 a2 = self.cleaned_data['_on_2nd'] |
134 a3 = self.cleaned_data['accomodation_on_3rd'] |
134 a3 = self.cleaned_data['_on_3rd'] |
135 a4 = self.cleaned_data['accomodation_on_4th'] |
135 a4 = self.cleaned_data['_on_4th'] |
136 a5 = self.cleaned_data['accomodation_on_5th'] |
136 a5 = self.cleaned_data['_on_5th'] |
137 a6 = self.cleaned_data['accomodation_on_6th'] |
137 a6 = self.cleaned_data['_on_6th'] |
138 |
138 |
139 selected_a_date = any([a1, a2, a3, a4, a5, a6]) |
139 selected_a_date = any([a1, a2, a3, a4, a5, a6]) |
140 |
140 |
141 if accommodation_required and (not sex or not selected_a_date): |
141 if accommodation_required and (not sex or not selected_a_date): |
142 #or accommodation_days == 0): |
142 #or accommodation_days == 0): |
148 |
148 |
149 class Meta: |
149 class Meta: |
150 model = Accommodation |
150 model = Accommodation |
151 fields = ('accommodation_required', |
151 fields = ('accommodation_required', |
152 'sex', |
152 'sex', |
153 'accomodation_on_1st', |
153 '_on_1st', |
154 'accomodation_on_2nd', |
154 '_on_2nd', |
155 'accomodation_on_3rd', |
155 '_on_3rd', |
156 'accomodation_on_4th', |
156 '_on_4th', |
157 'accomodation_on_5th', |
157 '_on_5th', |
158 'accomodation_on_6th', |
158 '_on_6th', |
159 ) |
159 ) |
160 |
160 |
161 |
161 |
162 class PaymentForm(forms.ModelForm): |
162 class PaymentForm(forms.ModelForm): |
163 """SciPyCon Payment form |
163 """SciPyCon Payment form |