diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/admin.py | 3 | ||||
-rw-r--r-- | ishtar_common/forms_common.py | 11 | ||||
-rw-r--r-- | ishtar_common/models.py | 1 |
3 files changed, 12 insertions, 3 deletions
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("_", "") |