|
17 | 17 |
|
18 | 18 | from ietf.ietfauth.utils import role_required, has_role |
19 | 19 | from ietf.group.models import Group, Role |
20 | | -from ietf.liaisons.models import (LiaisonStatement,LiaisonStatementEvent, |
21 | | - LiaisonStatementAttachment) |
| 20 | +from ietf.liaisons.models import LiaisonStatement,LiaisonStatementEvent |
22 | 21 | from ietf.liaisons.utils import (get_person_for_user, can_add_outgoing_liaison, |
23 | 22 | can_add_incoming_liaison, can_edit_liaison,can_submit_liaison_required, |
24 | 23 | can_add_liaison) |
@@ -377,23 +376,29 @@ def liaison_history(request, object_id): |
377 | 376 |
|
378 | 377 | def liaison_delete_attachment(request, object_id, attach_id): |
379 | 378 | liaison = get_object_or_404(LiaisonStatement, pk=object_id) |
380 | | - attach = get_object_or_404(LiaisonStatementAttachment, pk=attach_id) |
| 379 | + |
381 | 380 | if not can_edit_liaison(request.user, liaison): |
382 | 381 | permission_denied(request, "You are not authorized for this action.") |
383 | | - |
384 | | - # FIXME: this view should use POST instead of GET when deleting |
385 | | - attach.removed = True |
386 | | - attach.save() |
387 | | - |
388 | | - # create event |
389 | | - LiaisonStatementEvent.objects.create( |
390 | | - type_id='modified', |
391 | | - by=get_person_for_user(request.user), |
392 | | - statement=liaison, |
393 | | - desc='Attachment Removed: {}'.format(attach.document.title) |
394 | | - ) |
395 | | - messages.success(request, 'Attachment Deleted') |
396 | | - return redirect('ietf.liaisons.views.liaison_detail', object_id=liaison.pk) |
| 382 | + else: |
| 383 | + permission_denied(request, "This operation is temporarily unavailable. Ask the secretariat to mark the attachment as removed using the admin.") |
| 384 | + |
| 385 | + # The following will be replaced with a different approach in the next generation of the liaison tool |
| 386 | + # attach = get_object_or_404(LiaisonStatementAttachment, pk=attach_id) |
| 387 | + |
| 388 | + # # FIXME: this view should use POST instead of GET when deleting |
| 389 | + # attach.removed = True |
| 390 | + # debug.say("Got here") |
| 391 | + # attach.save() |
| 392 | + |
| 393 | + # # create event |
| 394 | + # LiaisonStatementEvent.objects.create( |
| 395 | + # type_id='modified', |
| 396 | + # by=get_person_for_user(request.user), |
| 397 | + # statement=liaison, |
| 398 | + # desc='Attachment Removed: {}'.format(attach.document.title) |
| 399 | + # ) |
| 400 | + # messages.success(request, 'Attachment Deleted') |
| 401 | + # return redirect('ietf.liaisons.views.liaison_detail', object_id=liaison.pk) |
397 | 402 |
|
398 | 403 | def liaison_detail(request, object_id): |
399 | 404 | liaison = get_object_or_404(LiaisonStatement, pk=object_id) |
|
0 commit comments