summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2025-09-24 11:34:33 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-09-24 11:34:33 +0200
commitd96f761a1fd9ef82f92fefc7dc84d202665741d6 (patch)
tree023c453d9d396f8a51715d44dffd6d2d70689e0e
parent59b0fd0d0e3f91d439dbf989d62bf04dcdb5b4d9 (diff)
downloadIshtar-d96f761a1fd9ef82f92fefc7dc84d202665741d6.tar.bz2
Ishtar-d96f761a1fd9ef82f92fefc7dc84d202665741d6.zip
🐛 fix add (+) shortcut in some popup windows
-rw-r--r--archaeological_finds/forms_treatments.py2
-rw-r--r--ishtar_common/forms_common.py7
-rw-r--r--ishtar_common/views_item.py5
3 files changed, 8 insertions, 6 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index ad12e7a18..a15571a06 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -455,7 +455,7 @@ class TreatmentDeletionForm(FinalForm):
confirm_end_msg = _("Would you like to delete this treatment?")
-class QABasePackagingForm(IshtarForm):
+class QABasePackagingForm(CustomForm, IshtarForm):
create_treatment = forms.BooleanField(
label=_("Create a treatment"), required=False,
widget=widgets.CheckboxInput
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index f9b79bf1b..56942fbe0 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -189,7 +189,7 @@ class PasswordChangeForm(SetPasswordForm, AuthPasswordChangeForm):
)
-class NewItemForm(forms.Form):
+class NewItemForm(CustomForm):
def __init__(self, *args, **kwargs):
self.limits = {}
if "limits" in kwargs:
@@ -198,7 +198,8 @@ class NewItemForm(forms.Form):
for item in limits.split(";"):
key, values = item.split("__")
self.limits[key] = values.split("-")
- super(NewItemForm, self).__init__(*args, **kwargs)
+ self.user = kwargs.pop("user") if "user" in kwargs else None
+ super().__init__(*args, **kwargs)
def limit_fields(self):
for key in self.limits:
@@ -1405,7 +1406,7 @@ class NoOrgaPersonForm(PersonForm):
self.fields.pop("attached_to")
-class BiographicalNoteForm(CustomForm, ManageOldType, NewItemForm):
+class BiographicalNoteForm(ManageOldType, NewItemForm):
form_label = _("Biographical note")
form_admin_name = _("Biographical note - 010 - General")
form_slug = "biographicalnote-general"
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index cce6006af..4f81a2cf0 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -285,8 +285,9 @@ def new_qa_item(
"parent_name": parent_name,
"many": many,
}
+ kwargs = {"limits": limits, "user": request.user}
if request.method == "POST":
- dct["form"] = frm(request.POST, limits=limits)
+ dct["form"] = frm(request.POST, **kwargs)
if dct["form"].is_valid():
new_item = dct["form"].save(request.user)
lbl = str(new_item)
@@ -302,7 +303,7 @@ def new_qa_item(
callback("new_qa_item", request, None, model.objects.filter(pk=new_item.pk))
return render(request, template, dct)
else:
- dct["form"] = frm(limits=limits)
+ dct["form"] = frm(**kwargs)
return render(request, template, dct)
return func