diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-14 08:26:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-14 08:26:09 +0200 |
commit | 63ffae36db57b1f2a0df50e43c04a0676df79bc9 (patch) | |
tree | 6b3f43532fa3bb38826a8b09c6c2aab221c94a9e /ishtar_common | |
parent | f94253032fa1bece95b546c36375ecba8331f9f4 (diff) | |
download | Ishtar-63ffae36db57b1f2a0df50e43c04a0676df79bc9.tar.bz2 Ishtar-63ffae36db57b1f2a0df50e43c04a0676df79bc9.zip |
Organization: multiple deletion - redirections after wizard changes
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms_common.py | 16 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/wizard/delete_wizard.html | 4 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/wizard/wizard_organization_deletion.html | 4 | ||||
-rw-r--r-- | ishtar_common/views.py | 6 | ||||
-rw-r--r-- | ishtar_common/wizards.py | 6 |
5 files changed, 26 insertions, 10 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 395b54b02..d8a4523ab 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -360,7 +360,7 @@ class OrganizationForm(ManageOldType, NewItemForm): return new_item -class OrganizationSelect(TableSelect): +class OrganizationSelect(CustomForm, TableSelect): _model = models.Organization search_vector = forms.CharField( @@ -390,6 +390,20 @@ class OrganizationFormSelection(forms.Form): validators=[models.valid_id(models.Organization)]) +class OrganizationFormMultiSelection(MultiSearchForm): + form_label = _(u"Organization search") + associated_models = {'pks': models.Organization} + pk = forms.CharField( + label="", + required=True, + widget=widgets.DataTable( + reverse_lazy('get-organization'), OrganizationSelect, + models.Organization, + multiple_select=True, + source_full=reverse_lazy('get-organization-full')), + validators=[models.valid_ids(models.Organization)]) + + class ManualMerge(object): def clean_to_merge(self): value = self.cleaned_data.get('to_merge', None) or [] diff --git a/ishtar_common/templates/ishtar/wizard/delete_wizard.html b/ishtar_common/templates/ishtar/wizard/delete_wizard.html index 82e074eae..21c5f31b5 100644 --- a/ishtar_common/templates/ishtar/wizard/delete_wizard.html +++ b/ishtar_common/templates/ishtar/wizard/delete_wizard.html @@ -25,10 +25,10 @@ {{form_label}} </div>{% endif %} <div class="card-body"> - {% if current_objs and current_objs.1 %}{% for current_object in current_objs %}{% if forloop.counter == forloop.parentloop.counter %} + {% for current_object in current_objs %}{% if forloop.counter == forloop.parentloop.counter %} {% block "detailled_extra_info" %} {% endblock %} - {% endif %}{% endfor %}{% endif %} + {% endif %}{% endfor %} <table class='table'> {% for data in form_data %} <tr{% if data.2 %} class='{{data.2}}'{%endif%}><th>{{data.0}}</th><td>{{data.1}}</td></tr> diff --git a/ishtar_common/templates/ishtar/wizard/wizard_organization_deletion.html b/ishtar_common/templates/ishtar/wizard/wizard_organization_deletion.html index 4f35f0c90..bd45ab5e8 100644 --- a/ishtar_common/templates/ishtar/wizard/wizard_organization_deletion.html +++ b/ishtar_common/templates/ishtar/wizard/wizard_organization_deletion.html @@ -1,6 +1,6 @@ -{% extends "ishtar/wizard/confirm_wizard.html" %} +{% extends "ishtar/wizard/delete_wizard.html" %} {% load i18n %} -{% block "extra_informations" %} +{% block "detailled_extra_info" %} {% if current_object.members.count %} <h3>{% trans "Associated persons" %}</h3> diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 0f2fe1276..150dfa2ca 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -175,7 +175,7 @@ def person_delete(request, pk): models.Person, pk): return HttpResponseRedirect("/") wizards.PersonDeletionWizard.session_set_value( - request, 'selec-person_deletion', 'pk', pk, reset=True) + request, 'selec-person_deletion', 'pks', pk, reset=True) return redirect(reverse('person_deletion', kwargs={'step': 'final-person_deletion'})) @@ -210,7 +210,7 @@ def organization_modify(request, pk): organization_deletion_wizard = wizards.OrganizationDeletionWizard.as_view( - [('selec-organization_deletion', forms.OrganizationFormSelection), + [('selec-organization_deletion', forms.OrganizationFormMultiSelection), ('final-organization_deletion', FinalDeleteForm)], label=_(u"Organization deletion"), url_name='organization_deletion',) @@ -222,7 +222,7 @@ def organization_delete(request, pk): return HttpResponseRedirect("/") wizard_url = 'organization_deletion' wizards.OrganizationDeletionWizard.session_set_value( - request, 'selec-' + wizard_url, 'pk', pk, reset=True) + request, 'selec-' + wizard_url, 'pks', pk, reset=True) return redirect( reverse(wizard_url, kwargs={'step': 'final-' + wizard_url})) diff --git a/ishtar_common/wizards.py b/ishtar_common/wizards.py index 5eb8e0ad1..9c89fd04b 100644 --- a/ishtar_common/wizards.py +++ b/ishtar_common/wizards.py @@ -1749,7 +1749,7 @@ class PersonModifWizard(PersonWizard): class PersonDeletionWizard(MultipleDeletionWizard): model = models.Person fields = model.TABLE_COLS - redirect_url = "person_search" + redirect_url = "person_deletion" wizard_templates = { 'final-person_deletion': 'ishtar/wizard/wizard_person_deletion.html'} @@ -1762,15 +1762,17 @@ class IshtarUserDeletionWizard(DeletionWizard): class OrganizationWizard(Wizard): model = models.Organization wizard_done_window = reverse_lazy('show-organization') + redirect_url = "organization_modification" class OrganizationModifWizard(OrganizationWizard): modification = True -class OrganizationDeletionWizard(DeletionWizard): +class OrganizationDeletionWizard(MultipleDeletionWizard): model = models.Organization fields = model.TABLE_COLS + redirect_url = "organization_deletion" wizard_templates = { 'final-organization_deletion': 'ishtar/wizard/wizard_organization_deletion.html'} |