diff options
author | Cefin <kevon@tuta.io> | 2021-12-03 13:08:52 +0000 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:49 +0200 |
commit | d068c965592ba645d8d297ec0f6e9c6805d4fb9c (patch) | |
tree | 4a421c6728d4949f4903756f6e6123d1b2e95fe6 | |
parent | 121382c0e1c5202c744b7ea8dcfe900ad95b4fa0 (diff) | |
download | Ishtar-d068c965592ba645d8d297ec0f6e9c6805d4fb9c.tar.bz2 Ishtar-d068c965592ba645d8d297ec0f6e9c6805d4fb9c.zip |
rapid action on person record add account #5216 part one
-rw-r--r-- | ishtar_common/models.py | 2 | ||||
-rw-r--r-- | ishtar_common/urls.py | 5 | ||||
-rw-r--r-- | ishtar_common/views.py | 16 |
3 files changed, 22 insertions, 1 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c8056a4ab..f16b9ffc9 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2919,7 +2919,7 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem): return actions actions += [ ( - reverse("person_create", args=[self.pk]), + reverse("account_creation", args=[self.pk]), _("Create new user"), "fa fa-user", "", diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 7bbdc189f..c21f51d71 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -203,6 +203,11 @@ urlpatterns = [ name="account_deletion", ), url( + r"account_creation/(?P<step>.+)?$", + check_rights(["add_ishtaruser"])(views.account_creation_wizard), + name="account_creation", + ), + url( r"^import-new/$", check_rights(["change_import"])(views.NewImportView.as_view()), name="new_import", diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 6f5953841..5b67f1bcb 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -319,6 +319,12 @@ account_management_wizard = wizards.AccountWizard.as_view( url_name="account_management", ) +account_creation_wizard = wizards.AccountWizard.as_view( + account_wizard_steps, + label=_("Account creation"), + url_name="account_creation", +) + account_deletion_wizard = wizards.IshtarUserDeletionWizard.as_view( [ ("selec-account_deletion", forms.AccountFormSelection), @@ -328,6 +334,16 @@ account_deletion_wizard = wizards.IshtarUserDeletionWizard.as_view( url_name="account_deletion", ) +def account_create(request, pk): + if not wizard_is_available(account_creation_wizard, request, models.IshtarUser): + return HttpResponseRedirect("/") + wizards.AccountWizard.session_set_value( + request, "selec-account_management", "pk", pk, reset=True + ) + return redirect( + reverse("account_creation", kwargs={"step": "account-account_management"}) + ) + def get_autocomplete_generic(model, extra=None): if not extra: |