summaryrefslogtreecommitdiff
path: root/ishtar_common
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
parent81696e2c35a2f94e7a4461eaf635fa006370ce6b (diff)
downloadIshtar-60f14b5615e6626b22c8a59958408f836fb27e7c.tar.bz2
Ishtar-60f14b5615e6626b22c8a59958408f836fb27e7c.zip
✨ organization - museofile ID: search, forms, sheet
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/forms_common.py17
-rw-r--r--ishtar_common/models.py7
-rw-r--r--ishtar_common/templates/ishtar/sheet_organization.html9
3 files changed, 29 insertions, 4 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),
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 6a758e72a..212026206 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2581,6 +2581,7 @@ class Organization(Address, Merge, OwnPerms, BaseGenderedType, ValueGetter, Main
BASE_SEARCH_VECTORS = [
SearchVectorConfig("name"),
SearchVectorConfig("town"),
+ SearchVectorConfig("museum_museofile_id", "raw"),
]
PROPERTY_SEARCH_VECTORS = [
SearchVectorConfig("precise_town_name"),
@@ -2599,6 +2600,10 @@ class Organization(Address, Merge, OwnPerms, BaseGenderedType, ValueGetter, Main
pgettext_lazy("key for text search", "precise-town"),
"precise_town_id",
),
+ "museum_museofile_id": SearchAltName(
+ pgettext_lazy("key for text search", "museofile"),
+ "museum_museofile_id__iexact",
+ ),
}
QA_EDIT = QuickAction(
url="organization-qa-bulk-update",
@@ -2626,7 +2631,7 @@ class Organization(Address, Merge, OwnPerms, BaseGenderedType, ValueGetter, Main
default="",
help_text=documentation_get_gender_values,
)
- museum_museofile_id = models.TextField(_("Museofile id"), blank=True, default="")
+ museum_museofile_id = models.TextField(_("Museofile ID"), blank=True, default="")
cached_label = models.TextField(
_("Cached name"), blank=True, default="", db_index=True
)
diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html
index f2618bb58..b6d18469d 100644
--- a/ishtar_common/templates/ishtar/sheet_organization.html
+++ b/ishtar_common/templates/ishtar/sheet_organization.html
@@ -12,7 +12,7 @@
{% field_flex "Name" item.name %}
{% field_flex "Type" item.organization_type %}
{% field_flex_url "Web address" item.url %}
- {% field_flex_detail "Created by" item.history_creator.ishtaruser.person %}
+ {% field_flex "Museofile ID" item.museum_museofile_id %}
{% include "ishtar/blocks/sheet_address_section.html" %}
{% field_flex "Phone" item.phone %}
{% field_flex "Mobile phone" item.mobile_phone %}
@@ -79,4 +79,11 @@
{% dynamic_table_document publications 'documents' 'publisher__pk' item.pk '' output %}
{% endif %}
+{% if not is_external %}
+<h3>{% trans "Sheet"%}</h3>
+<div class="row">
+ {% include "ishtar/blocks/sheet_creation_section.html" %}
+</div>
+{% endif %}
+
{% endblock %}