summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-13 16:52:49 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2019-09-13 16:52:49 +0200
commitbbde20e66cf624a7919050548cbfa8248173c49f (patch)
tree5485667cc5b8610d1e8d538162faecba333366e5 /ishtar_common
parent9dbf9e39344f8165482b116bfabcaa442eb66c6a (diff)
downloadIshtar-bbde20e66cf624a7919050548cbfa8248173c49f.tar.bz2
Ishtar-bbde20e66cf624a7919050548cbfa8248173c49f.zip
Delete action: operations, sites, orgas, containers, warehouses
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py1
-rw-r--r--ishtar_common/urls.py2
-rw-r--r--ishtar_common/views.py24
3 files changed, 24 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index d5450916b..fba1212c7 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -4019,6 +4019,7 @@ class Organization(Address, Merge, OwnPerms, ValueGetter):
TABLE_COLS = ('name', 'organization_type', 'town')
SLUG = "organization"
SHOW_URL = 'show-organization'
+ DELETE_URL = 'delete-organization'
# search parameters
EXTRA_REQUEST_KEYS = {}
diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py
index 1c0ddc495..fd9083e91 100644
--- a/ishtar_common/urls.py
+++ b/ishtar_common/urls.py
@@ -96,6 +96,8 @@ urlpatterns = [
url(r'organization_deletion/(?P<step>.+)?$',
check_rights(['change_organization', 'change_own_organization'])(
views.organization_deletion_wizard), name='organization_deletion'),
+ url(r'organization_delete/(?P<pk>.+)/$', views.organization_delete,
+ name='delete-organization'),
url(r'organization-edit/$',
check_rights(['add_organization'])(
views.OrganizationCreate.as_view()), name='organization_create'),
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index abd2b79d8..0f0854720 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -154,7 +154,9 @@ person_modification_wizard = wizards.PersonModifWizard.as_view(
def person_modify(request, pk):
- person_modification_wizard(request)
+ if not wizard_is_available(person_modification_wizard, request,
+ models.Person, pk):
+ return HttpResponseRedirect("/")
wizards.PersonModifWizard.session_set_value(
request, 'selec-person_modification', 'pk', pk, reset=True)
return redirect(reverse('person_modification',
@@ -169,7 +171,9 @@ person_deletion_wizard = wizards.PersonDeletionWizard.as_view(
def person_delete(request, pk):
- person_deletion_wizard(request)
+ if not wizard_is_available(person_deletion_wizard, request,
+ models.Person, pk):
+ return HttpResponseRedirect("/")
wizards.PersonDeletionWizard.session_set_value(
request, 'selec-person_deletion', 'pk', pk, reset=True)
return redirect(reverse('person_deletion',
@@ -195,7 +199,9 @@ organization_modification_wizard = wizards.OrganizationModifWizard.as_view(
def organization_modify(request, pk):
- organization_modification_wizard(request)
+ if not wizard_is_available(organization_modification_wizard, request,
+ models.Organization, pk):
+ return HttpResponseRedirect("/")
wizards.OrganizationModifWizard.session_set_value(
request, 'selec-organization_modification', 'pk', pk, reset=True)
return redirect(
@@ -209,6 +215,18 @@ organization_deletion_wizard = wizards.OrganizationDeletionWizard.as_view(
label=_(u"Organization deletion"),
url_name='organization_deletion',)
+
+def organization_delete(request, pk):
+ if not wizard_is_available(organization_deletion_wizard, request,
+ models.Organization, pk):
+ return HttpResponseRedirect("/")
+ wizard_url = 'organization_deletion'
+ wizards.OrganizationDeletionWizard.session_set_value(
+ request, 'selec-' + wizard_url, 'pk', pk, reset=True)
+ return redirect(
+ reverse(wizard_url,
+ kwargs={'step': 'final-' + wizard_url}))
+
account_wizard_steps = [
('selec-account_management', forms.PersonUserFormSelection),
('account-account_management', forms.AccountForm),