diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-02-27 16:18:33 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-02-27 16:50:35 +0100 |
commit | 896919c02fb0f1d3fe3febdb5f61e62573a5ca55 (patch) | |
tree | 62e43359d34e57f133df0ef8ae199bead264b66c /ishtar_common/forms_common.py | |
parent | 4566c05ecafbba8c89e0a5f343742ad8862e41ad (diff) | |
download | Ishtar-896919c02fb0f1d3fe3febdb5f61e62573a5ca55.tar.bz2 Ishtar-896919c02fb0f1d3fe3febdb5f61e62573a5ca55.zip |
✨ organization - museofile ID: search, forms, sheet
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r-- | ishtar_common/forms_common.py | 17 |
1 files changed, 15 insertions, 2 deletions
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), |