summaryrefslogtreecommitdiff
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-02-27 16:50:35 +0100
commit896919c02fb0f1d3fe3febdb5f61e62573a5ca55 (patch)
tree62e43359d34e57f133df0ef8ae199bead264b66c
parent4566c05ecafbba8c89e0a5f343742ad8862e41ad (diff)
downloadIshtar-896919c02fb0f1d3fe3febdb5f61e62573a5ca55.tar.bz2
Ishtar-896919c02fb0f1d3fe3febdb5f61e62573a5ca55.zip
✨ organization - museofile ID: search, forms, sheet
-rw-r--r--archaeological_finds/forms.py4
-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
4 files changed, 31 insertions, 6 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 13e1ec1f0..54de64f93 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -252,9 +252,9 @@ class BasicFindForm(CustomForm, ManageOldType):
"previous_id",
"laboratory_id",
"seal_number",
- "mark",
"museum_inventory_marking_presence",
"museum_marking_type",
+ "mark",
"museum_owner_institution",
"museum_custodian_institution",
"museum_depositor_inventory_number",
@@ -626,9 +626,9 @@ class FindForm(BasicFindForm):
"get_first_base_find__excavation_id",
"laboratory_id",
"seal_number",
- "mark",
"museum_inventory_marking_presence",
"museum_marking_type",
+ "mark",
"museum_owner_institution",
"museum_custodian_institution",
"museum_depositor_inventory_number",
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 %}