Revision 9024ed2e snf-astakos-app/astakos/im/views/projects.py
b/snf-astakos-app/astakos/im/views/projects.py | ||
---|---|---|
114 | 114 |
|
115 | 115 |
response = None |
116 | 116 |
with ExceptionHandler(request): |
117 |
response = _create_object( |
|
118 |
request, |
|
119 |
template_name='im/projects/projectapplication_form.html', |
|
120 |
extra_context=extra_context, |
|
121 |
post_save_redirect=reverse('project_list'), |
|
122 |
form_class=ProjectApplicationForm, |
|
123 |
msg=_("The %(verbose_name)s has been received and " |
|
124 |
"is under consideration.")) |
|
117 |
response = create_app_object(request, extra_context=extra_context) |
|
125 | 118 |
|
126 | 119 |
if response is not None: |
127 | 120 |
return response |
... | ... | |
131 | 124 |
return redirect(next) |
132 | 125 |
|
133 | 126 |
|
127 |
@commit_on_success_strict() |
|
128 |
def create_app_object(request, extra_context=None): |
|
129 |
try: |
|
130 |
return _create_object( |
|
131 |
request, |
|
132 |
template_name='im/projects/projectapplication_form.html', |
|
133 |
extra_context=extra_context, |
|
134 |
post_save_redirect=reverse('project_list'), |
|
135 |
form_class=ProjectApplicationForm, |
|
136 |
msg=_("The %(verbose_name)s has been received and " |
|
137 |
"is under consideration.")) |
|
138 |
except (IOError, PermissionDenied) as e: |
|
139 |
messages.error(request, e) |
|
140 |
|
|
141 |
|
|
134 | 142 |
@require_http_methods(["GET"]) |
135 | 143 |
@cookie_fix |
136 | 144 |
@valid_astakos_user_required |
... | ... | |
234 | 242 |
|
235 | 243 |
response = None |
236 | 244 |
with ExceptionHandler(request): |
237 |
response = _update_object( |
|
238 |
request, |
|
239 |
object_id=application_id, |
|
240 |
template_name='im/projects/projectapplication_form.html', |
|
241 |
extra_context=extra_context, |
|
242 |
post_save_redirect=reverse('project_list'), |
|
243 |
form_class=ProjectApplicationForm, |
|
244 |
msg=_("The %(verbose_name)s has been received and is under " |
|
245 |
"consideration.")) |
|
245 |
response = update_app_object(request, application_id, |
|
246 |
extra_context=extra_context) |
|
246 | 247 |
|
247 | 248 |
if response is not None: |
248 | 249 |
return response |
... | ... | |
252 | 253 |
return redirect(next) |
253 | 254 |
|
254 | 255 |
|
256 |
@commit_on_success_strict() |
|
257 |
def update_app_object(request, object_id, extra_context=None): |
|
258 |
try: |
|
259 |
return _update_object( |
|
260 |
request, |
|
261 |
object_id=object_id, |
|
262 |
template_name='im/projects/projectapplication_form.html', |
|
263 |
extra_context=extra_context, |
|
264 |
post_save_redirect=reverse('project_list'), |
|
265 |
form_class=ProjectApplicationForm, |
|
266 |
msg=_("The %(verbose_name)s has been received and is under " |
|
267 |
"consideration.")) |
|
268 |
except (IOError, PermissionDenied) as e: |
|
269 |
messages.error(request, e) |
|
270 |
|
|
271 |
|
|
255 | 272 |
@require_http_methods(["GET", "POST"]) |
256 | 273 |
@cookie_fix |
257 | 274 |
@valid_astakos_user_required |
Also available in: Unified diff