summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-11-28 18:09:08 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-11-28 18:16:20 +0100
commit20954e71e00a2199dde84eb9d5aa42e3bcb155fa (patch)
tree09f31e062e40021519da4cb2b937142ca8986bc7
parent9420da55e9e50cebdbefcb1de977d67dc13ae43e (diff)
downloadIshtar-20954e71e00a2199dde84eb9d5aa42e3bcb155fa.tar.bz2
Ishtar-20954e71e00a2199dde84eb9d5aa42e3bcb155fa.zip
🐛 Custom form - add missing forms types (refs #5668)
-rw-r--r--changelog/en/changelog_2022-06-15.md1
-rw-r--r--changelog/fr/changelog_2023-01-25.md1
-rw-r--r--ishtar_common/admin.py3
-rw-r--r--ishtar_common/forms_common.py11
-rw-r--r--ishtar_common/models.py1
5 files changed, 14 insertions, 3 deletions
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md
index 26b4a7bbe..f58362514 100644
--- a/changelog/en/changelog_2022-06-15.md
+++ b/changelog/en/changelog_2022-06-15.md
@@ -8,6 +8,7 @@ v4.0.67 - 2023-11-28
- fix "default center" field (#5675)
- Document table: fix performance issue on sort (#5667)
- Document bulk update: fix to add new author (#5681)
+- Custom form - add missing forms types (#5668)
v4.0.66 - 2023-11-22
--------------------
diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md
index 773a71b85..020ac98a2 100644
--- a/changelog/fr/changelog_2023-01-25.md
+++ b/changelog/fr/changelog_2023-01-25.md
@@ -8,6 +8,7 @@ v4.0.67 - 2023-11-28
- correction du champ "centre par défaut" (#5675)
- Table documents : correction d'un problème de performance lors du tri (#5667)
- Document - Formulaire de mise à jour groupée : correction de l'ajout de nouveau auteur (#5681)
+- Formulaire personalisé : ajout de type de formulaire manquants (#5668)
v4.0.66 - 2023-11-22
--------------------
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index ae4a3227b..764dd2624 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -73,7 +73,7 @@ from ishtar_common.apps import admin_site
from ishtar_common.model_merging import merge_model_objects
from ishtar_common.utils import get_cache, create_slug
-from ishtar_common import forms as common_forms
+from ishtar_common import forms as common_forms, forms_common as other_common_forms
from ishtar_common.serializers import restore_serialized, IMPORT_MODEL_LIST
from ishtar_common.serializers_utils import generic_get_results, serialization_info
from archaeological_files import forms as file_forms
@@ -93,6 +93,7 @@ csrf_protect_m = method_decorator(csrf_protect)
ISHTAR_FORMS = [
common_forms,
+ other_common_forms,
file_forms,
operation_forms,
context_record_forms,
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index ecff07888..3747a03c6 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -1294,6 +1294,7 @@ class AccountForm(IshtarForm):
class ProfileForm(ManageOldType):
form_label = _("Profiles")
base_model = "profile"
+ NO_CUSTOM_FORM = True
associated_models = {"profile_type": models.ProfileType, "area": models.Area}
profile_type = forms.ChoiceField(label=_("Type"), choices=[])
area = widgets.Select2MultipleField(label=_("Areas"), required=False)
@@ -1330,6 +1331,7 @@ ProfileFormset = formset_factory(
ProfileFormset.form_label = _("Profiles")
ProfileFormset.form_admin_name = _("Profiles")
ProfileFormset.form_slug = "profiles"
+ProfileFormset.NO_CUSTOM_FORM = True
class FinalAccountForm(forms.Form):
@@ -1512,6 +1514,7 @@ class ProfilePersonForm(forms.Form):
class TownForm(forms.Form):
form_label = _("Towns")
base_model = "town"
+ NO_CUSTOM_FORM = True
associated_models = {"town": models.Town}
town = get_town_field(required=False)
@@ -1526,6 +1529,7 @@ TownFormset = formset_factory(TownForm, can_delete=True, formset=TownFormSet)
TownFormset.form_label = _("Towns")
TownFormset.form_admin_name = _("Towns")
TownFormset.form_slug = "towns"
+TownFormset.NO_CUSTOM_FORM = True
class MergeFormSet(BaseModelFormSet):
@@ -1706,7 +1710,7 @@ def max_value_current_year(value):
class DocumentForm(forms.ModelForm, CustomForm, ManageOldType):
form_label = _("Documentation")
- form_admin_name = _("Document - General")
+ form_admin_name = _("Document - 010 - General")
form_slug = "document-general"
file_upload = True
extra_form_modals = ["author", "person", "organization", "documenttag", "container"]
@@ -2506,6 +2510,7 @@ class SourceDeletionForm(FinalForm):
class AuthorForm(ManageOldType, NewItemForm):
form_label = _("Author")
associated_models = {"person": models.Person, "author_type": models.AuthorType}
+ NO_CUSTOM_FORM = True
person = forms.IntegerField(
widget=widgets.JQueryAutoComplete(
"/" + settings.URL_PATH + "autocomplete-person",
@@ -2545,6 +2550,7 @@ class AuthorForm(ManageOldType, NewItemForm):
class AuthorFormSelection(forms.Form):
form_label = _("Author selection")
+ NO_CUSTOM_FORM = True
base_model = "author"
associated_models = {"author": models.Author}
author = forms.IntegerField(
@@ -2571,6 +2577,7 @@ AuthorFormset = formset_factory(
AuthorFormset.form_label = _("Authors")
AuthorFormset.form_admin_name = _("Authors")
AuthorFormset.form_slug = "authors"
+AuthorFormset.NO_CUSTOM_FORM = True
class SearchQueryForm(forms.Form):
@@ -2669,7 +2676,7 @@ class QRSearchForm(forms.Form):
class GISForm(forms.ModelForm, CustomForm, ManageOldType):
form_label = _("Geo item")
- form_admin_name = _("Geo item - General")
+ form_admin_name = _("Geo item - 010 - General")
form_slug = "geoitem-general"
extra_form_modals = []
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 27388658c..6d644cb63 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1711,6 +1711,7 @@ class CustomForm(models.Model):
not inspect.isclass(form)
or not issubclass(form, CustomFormForm)
or not getattr(form, "form_slug", None)
+ or getattr(form, "NO_CUSTOM_FORM", False)
):
continue
model_name = form.form_slug.split("-")[0].replace("_", "")