From 60f14b5615e6626b22c8a59958408f836fb27e7c Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 27 Feb 2024 16:18:33 +0100 Subject: ✨ organization - museofile ID: search, forms, sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ishtar_common/forms_common.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 0f0ca58a4..66ace87f1 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -764,6 +764,7 @@ class OrganizationForm(ManageOldType, NewItemForm): required=False, help_text=_("Can be used by templates"), ) + museum_museofile_id = forms.CharField(label=_("Museofile ID"), required=False) address = forms.CharField(label=_("Address"), widget=forms.Textarea, required=False) address_complement = forms.CharField( label=_("Address complement"), widget=forms.Textarea, required=False @@ -777,9 +778,12 @@ class OrganizationForm(ManageOldType, NewItemForm): mobile_phone = forms.CharField( label=_("Mobile phone"), max_length=32, required=False ) + PROFILE_FILTER = { + "museum": ["museum_museofile_id"] + } def __init__(self, *args, **kwargs): - super(OrganizationForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields["organization_type"].choices = models.OrganizationType.get_types( initial=self.init_data.get("organization_type") ) @@ -811,6 +815,9 @@ class OrganizationForm(ManageOldType, NewItemForm): class OrganizationSelect(CustomForm, TableSelect): _model = models.Organization + PROFILE_FILTER = { + "museum": ["museum_museofile_id"] + } search_vector = forms.CharField( label=_("Full text search"), @@ -819,6 +826,7 @@ class OrganizationSelect(CustomForm, TableSelect): name = forms.CharField(label=_("Name"), max_length=300) organization_type = forms.ChoiceField(label=_("Type"), choices=[]) precise_town_id = get_town_field() + museum_museofile_id = forms.CharField(label=_("Museofile ID"), required=False) def __init__(self, *args, **kwargs): super(OrganizationSelect, self).__init__(*args, **kwargs) @@ -868,10 +876,15 @@ class QAOrganizationFormMulti(QAForm): } MULTI = True - REPLACE_FIELDS = ["qa_organization_type", "qa_grammatical_gender"] + REPLACE_FIELDS = ["qa_organization_type", "qa_grammatical_gender", "qa_museum_museofile_id"] + SINGLE_FIELDS = ["qa_museum_museofile_id"] + PROFILE_FILTER = { + "museum": ["qa_museum_museofile_id"] + } qa_organization_type = forms.ChoiceField( label=_("Organization type"), required=False ) + qa_museum_museofile_id = forms.CharField(label=_("Museofile ID"), required=False) qa_grammatical_gender = forms.ChoiceField( label=_("Grammatical gender"), choices=[("", "--")] + list(models.GENDER), -- cgit v1.2.3