From 247987acf353400c0b90bf78cbc29473ce7ad43c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 13 Sep 2019 12:02:12 +0200 Subject: Manage delete action on sheet - delete action for persons --- ishtar_common/models.py | 1 + ishtar_common/templates/ishtar/blocks/window_nav.html | 6 ++++++ ishtar_common/templatetags/window_header.py | 13 +++++++++---- ishtar_common/urls.py | 2 ++ ishtar_common/views.py | 8 ++++++++ 5 files changed, 26 insertions(+), 4 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 39d949ece..4f82a1663 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -4142,6 +4142,7 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem): 'profiles_list', 'attached_to', 'town') SHOW_URL = 'show-person' MODIFY_URL = 'person_modify' + DELETE_URL = 'person_delete' BASE_SEARCH_VECTORS = [ SearchVectorConfig('name'), SearchVectorConfig('surname'), diff --git a/ishtar_common/templates/ishtar/blocks/window_nav.html b/ishtar_common/templates/ishtar/blocks/window_nav.html index 19b70ccd6..c248bae82 100644 --- a/ishtar_common/templates/ishtar/blocks/window_nav.html +++ b/ishtar_common/templates/ishtar/blocks/window_nav.html @@ -56,6 +56,12 @@ {{extra_text}} {% endfor %} + {% if delete_url and not item.locked %} + + + + {% endif %}
.+)?$', check_rights(['change_person', 'change_own_person'])( views.person_deletion_wizard), name='person_deletion'), + url(r'person_delete/(?P.+)/$', views.person_delete, + name='person_delete'), url(r'^person-edit/$', check_rights(['add_person'])( views.PersonCreate.as_view()), name='person_create'), diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 157f7ecc3..5a4abdc38 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -148,6 +148,14 @@ person_deletion_wizard = wizards.PersonDeletionWizard.as_view( label=_(u"Person deletion"), url_name='person_deletion',) + +def person_delete(request, pk): + person_deletion_wizard(request) + wizards.PersonDeletionWizard.session_set_value( + request, 'selec-person_deletion', 'pk', pk, reset=True) + return redirect(reverse('person_deletion', + kwargs={'step': 'final-person_deletion'})) + organization_search_wizard = wizards.OrganizationSearch.as_view( [('general-organization_search', forms.OrganizationFormSelection)], label=_(u"Organization search"), -- cgit v1.2.3