From e0ed1f16e23b95752cefd53011264801b7e96112 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 14 Sep 2019 16:34:37 +0200 Subject: Document: delete action on sheet --- ishtar_common/models.py | 1 + ishtar_common/urls.py | 2 ++ ishtar_common/views.py | 11 +++++++++++ 3 files changed, 14 insertions(+) (limited to 'ishtar_common') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index fba1212c7..c82837483 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -4929,6 +4929,7 @@ post_delete.connect(post_save_cache, sender=LicenseType) class Document(BaseHistorizedItem, OwnPerms, ImageModel, ValueGetter, MainItem): EXTERNAL_ID_KEY = 'document_external_id' + DELETE_URL = 'delete-document' # order is important: put the image in the first match found # other will be symbolic links RELATED_MODELS = [ diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index fd9083e91..07e084e40 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -286,6 +286,8 @@ urlpatterns += [ check_rights(['change_document', 'change_own_document'])( views.document_deletion_wizard), name='document_deletion'), + url(r'document/shortcut/delete/(?P.+)/$', views.document_delete, + name='delete-document'), url(r'^document-qa-bulk-update/(?P[0-9-]+)?/$', check_rights(['change_document', 'change_own_document'])( diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 710d6d7e6..784a8bd0f 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1982,6 +1982,17 @@ document_deletion_wizard = wizards.DocumentDeletionWizard.as_view( url_name='document_deletion',) +def document_delete(request, pk): + if not wizard_is_available(document_deletion_wizard, request, + models.Document, pk): + return HttpResponseRedirect("/") + wizard_url = 'document_deletion' + wizards.DocumentDeletionWizard.session_set_value( + request, 'selec-' + wizard_url, 'pks', pk, reset=True) + return redirect(reverse(wizard_url, + kwargs={'step': 'final-' + wizard_url})) + + def get_bookmark(request, pk): try: sq = models.SearchQuery.objects.get( -- cgit v1.2.3