summaryrefslogtreecommitdiff
path: root/ishtar_common/forms_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-27 16:18:33 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:42:33 +0200
commit60f14b5615e6626b22c8a59958408f836fb27e7c (patch)
tree464fd4a310e2858d8a84ffb7d062f8d393a8aca7 /ishtar_common/forms_common.py
parent81696e2c35a2f94e7a4461eaf635fa006370ce6b (diff)
downloadIshtar-60f14b5615e6626b22c8a59958408f836fb27e7c.tar.bz2
Ishtar-60f14b5615e6626b22c8a59958408f836fb27e7c.zip
✨ organization - museofile ID: search, forms, sheet
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r--ishtar_common/forms_common.py17
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),