176 form = context['form'] |
176 form = context['form'] |
177 |
177 |
178 if 'scope_path' in form.initial: |
178 if 'scope_path' in form.initial: |
179 scope_path = form.initial['scope_path'] |
179 scope_path = form.initial['scope_path'] |
180 elif 'scope_path' in request.POST: |
180 elif 'scope_path' in request.POST: |
181 # TODO do this nicely |
|
182 scope_path = request.POST['scope_path'] |
181 scope_path = request.POST['scope_path'] |
183 else: |
182 else: |
184 # TODO is this always sufficient? |
|
185 form.fields['student_agreement'] = None |
183 form.fields['student_agreement'] = None |
186 return |
184 return |
187 |
185 |
188 program = program_logic.logic.getFromKeyName(scope_path) |
186 program = program_logic.logic.getFromKeyName(scope_path) |
189 |
187 |
190 if not (program and program.student_agreement): |
188 if not (program and program.student_agreement): |
191 return |
189 return |
192 |
190 |
193 content = program.student_agreement.content |
191 agreement = program.student_agreement |
194 form.fields['student_agreement'].widget.text = content |
192 |
|
193 content = agreement.content |
|
194 params = {'url_name': 'document'} |
|
195 |
|
196 widget = form.fields['student_agreement'].widget |
|
197 widget.text = content |
|
198 widget.url = redirects.getPublicRedirect(agreement, params) |
195 |
199 |
196 |
200 |
197 view = View() |
201 view = View() |
198 |
202 |
199 apply = decorators.view(view.apply) |
203 apply = decorators.view(view.apply) |