diff options
-rw-r--r-- | ishtar_common/forms_common.py | 8 | ||||
-rw-r--r-- | ishtar_common/migrations/0239_shootingangle_parent.py | 19 | ||||
-rw-r--r-- | ishtar_common/models.py | 7 | ||||
-rw-r--r-- | ishtar_common/views_item.py | 1 |
4 files changed, 33 insertions, 2 deletions
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 53a7f7d17..0f0ca58a4 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -2425,6 +2425,7 @@ class DocumentSelect(HistorySelect): format = forms.ChoiceField(label=_("Format"), choices=[]) support = forms.ChoiceField(label=_("Medium"), choices=[]) scale = forms.CharField(label=_("Scale")) + shooting_angle = forms.ChoiceField(label=_("Shooting angle"), choices=[]) associated_url = forms.CharField(label=_("Web address")) tag = forms.ChoiceField(label=_("Tag"), choices=[]) publisher = forms.IntegerField( @@ -2570,6 +2571,7 @@ class DocumentSelect(HistorySelect): FieldType("licenses", models.LicenseType), FieldType("operations__operation_type", models.OperationType), FieldType("area", models.Area), + FieldType("shooting_angle", models.ShootingAngle), ] PROFILE_FILTER = { @@ -2617,13 +2619,14 @@ class DocumentFormMultiSelection(LockForm, MultiSearchForm): class QADocumentFormMulti(QAForm): form_admin_name = _("Document - Quick action - Modify") form_slug = "document-quickaction-modify" - base_models = ["qa_source_type", "qa_rights_owner"] + base_models = ["qa_source_type", "qa_rights_owner", "qa_shooting_angle"] associated_models = { "qa_source_type": models.SourceType, "qa_authors": models.Author, "qa_tags": models.DocumentTag, "qa_rights_owner": models.Organization, "qa_licenses": models.LicenseType, + "qa_shooting_angle": models.ShootingAngle, } MULTI = True @@ -2633,6 +2636,7 @@ class QADocumentFormMulti(QAForm): "qa_rights_owner", "qa_licenses", "qa_copyright", + "qa_shooting_angle", ] qa_source_type = forms.ChoiceField(label=_("Source type"), required=False) qa_authors = widgets.ModelJQueryAutocompleteField( @@ -2650,6 +2654,7 @@ class QADocumentFormMulti(QAForm): model=models.Organization, label=_("Rights owner"), new=True, required=False ) qa_copyright = forms.CharField(label=_("Copyright"), required=False) + qa_shooting_angle = forms.ChoiceField(label=_("Shooting angle"), choices=[], required=False) TYPES = [ FieldType("qa_source_type", models.SourceType), @@ -2657,6 +2662,7 @@ class QADocumentFormMulti(QAForm): FieldType("qa_support_type", models.SupportType), FieldType("qa_licenses", models.LicenseType), FieldType("qa_tags", models.DocumentTag), + FieldType("qa_shooting_angle", models.ShootingAngle), ] def _get_qa_authors(self, value): diff --git a/ishtar_common/migrations/0239_shootingangle_parent.py b/ishtar_common/migrations/0239_shootingangle_parent.py new file mode 100644 index 000000000..fc023ccbc --- /dev/null +++ b/ishtar_common/migrations/0239_shootingangle_parent.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.24 on 2024-02-27 11:20 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('ishtar_common', '0238_biographicalnote_slug'), + ] + + operations = [ + migrations.AddField( + model_name='shootingangle', + name='parent', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='ishtar_common.ShootingAngle', verbose_name='Parent'), + ), + ] diff --git a/ishtar_common/models.py b/ishtar_common/models.py index e05bcad2d..6a758e72a 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -4064,7 +4064,7 @@ post_save.connect(post_save_cache, sender=DocumentTag) post_delete.connect(post_save_cache, sender=DocumentTag) -class ShootingAngle(OrderedType): +class ShootingAngle(OrderedHierarchicalType): class Meta: verbose_name = _("Shooting angle") verbose_name_plural = _("Shooting angles") @@ -4183,6 +4183,7 @@ class Document( SearchVectorConfig("files__cached_label"), SearchVectorConfig("towns__name"), SearchVectorConfig("areas__label"), + SearchVectorConfig("shooting_angle__label"), ] PARENT_SEARCH_VECTORS = [ "authors", @@ -4399,6 +4400,10 @@ class Document( pgettext_lazy("key for text search", "creation-date-after"), "creation_date__gte", ), + "shooting_angle": SearchAltName( + pgettext_lazy("key for text search", "shooting-angle"), + "shooting_angle__label__iexact", + ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 070a7ce53..dddeab938 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -568,6 +568,7 @@ LIST_FIELDS = { # key: hierarchic depth "source_type": HIERARCHIC_LEVELS, "unit": HIERARCHIC_LEVELS, "museum_collection_entry_mode": HIERARCHIC_LEVELS, + "shooting_angle": HIERARCHIC_LEVELS, "museum_inventory_marking_presence": 0, "museum_marking_type": 0, "museum_collection": 0, |