diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-24 16:34:07 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2026-04-24 16:53:20 +0200 |
| commit | 14eb8da0f0db27c03fc23628be88b85e0e1169ae (patch) | |
| tree | 20a98627614a3d7c92302aa4d1320639563086c6 | |
| parent | fb8f2ab9b8fc95bfa63b5d749a1c79ce8a55756c (diff) | |
| download | Ishtar-14eb8da0f0db27c03fc23628be88b85e0e1169ae.tar.bz2 Ishtar-14eb8da0f0db27c03fc23628be88b85e0e1169ae.zip | |
✨ sheet: display editors - add editors link on person sheet (refs #6718)
| -rw-r--r-- | archaeological_context_records/models.py | 1 | ||||
| -rw-r--r-- | archaeological_files/models.py | 1 | ||||
| -rw-r--r-- | archaeological_finds/models_finds.py | 3 | ||||
| -rw-r--r-- | archaeological_finds/models_treatments.py | 2 | ||||
| -rw-r--r-- | archaeological_operations/models.py | 3 | ||||
| -rw-r--r-- | archaeological_operations/templates/ishtar/sheet_site.html | 1 | ||||
| -rw-r--r-- | archaeological_warehouse/models.py | 2 | ||||
| -rw-r--r-- | ishtar_common/models.py | 45 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_creation_section.html | 3 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet_person.html | 78 | ||||
| -rw-r--r-- | ishtar_common/urls.py | 5 | ||||
| -rw-r--r-- | ishtar_common/views.py | 12 |
12 files changed, 131 insertions, 25 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 6b6f0f039..88278005e 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -433,6 +433,7 @@ class ContextRecord( "operation_id": "operation_id", # dynamic_table_documents "excavator_id": "excavator_id", # dynamic_table_documents "unit__label": "unit__label", + "editors__person_id": "editors__person_id", # dynamic_table_documents } MANY_COUNTED_FIELDS = ["base_finds__isnull"] REVERSED_BOOL_FIELDS = [ diff --git a/archaeological_files/models.py b/archaeological_files/models.py index fec8625cd..3bf7f9b8e 100644 --- a/archaeological_files/models.py +++ b/archaeological_files/models.py @@ -599,6 +599,7 @@ class File( "general_contractor__pk": "general_contractor__pk", "responsible_town_planning_service__pk": "responsible_town_planning_service__pk", "in_charge__pk": "in_charge__pk", + "editors__person_id": "editors__person_id", # dynamic_table_documents } BASE_SEARCH_VECTORS = [ SearchVectorConfig("name"), diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index e475318af..f7cd67968 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1472,7 +1472,8 @@ class Find( "documents__image__isnull": "documents__image__isnull", "container__location": "container__location__pk", "container_ref__location": "container_ref__location__pk", - "base_finds__excavation_id": "base_finds__excavation_id" + "base_finds__excavation_id": "base_finds__excavation_id", + "editors__person_id": "editors__person_id", # dynamic_table_documents } for table in (TABLE_COLS, TABLE_COLS_FOR_OPE): for key in table: diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 77f66fae8..ab16711d1 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -236,6 +236,7 @@ class Treatment( "person__cached_label": "person__cached_label", "scientific_monitoring_manager__cached_label": "scientific_monitoring_manager__cached_label", "person__pk": "person__pk", # used by dynamic_table_documents + "editors__person_id": "editors__person_id", # dynamic_table_documents } COL_LABELS = { "downstream_cached_label": _("Downstream find"), @@ -1351,6 +1352,7 @@ class TreatmentFile( EXTRA_REQUEST_KEYS = { "in_charge__pk": "in_charge__pk", # used by dynamic_table_documents "applicant__pk": "applicant__pk", # used by dynamic_table_documents + "editors__person_id": "editors__person_id", # dynamic_table_documents } REVERSED_BOOL_FIELDS = [ "documents__image__isnull", diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index a3fe2ea3f..fc3a8a097 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -486,6 +486,7 @@ class ArchaeologicalSite( "collaborators__pk": "collaborators__pk", # dynamic_table_documents "discoverer_id": "discoverer_id", # dynamic_table_documents "types__label": "types__label", + "editors__person_id": "editors__person_id", # dynamic_table_documents } # alternative names of fields for searches @@ -1463,6 +1464,7 @@ class Operation( "collaborators__pk": "collaborators__pk", # dynamic_table_documents "cira_rapporteur__pk": "cira_rapporteur__pk", # dynamic_table_documents "operator__pk": "operator__pk", # dynamic_table_documents + "editors__person_id": "editors__person_id", # dynamic_table_documents } COL_LABELS = { @@ -3180,6 +3182,7 @@ class AdministrativeAct(DocumentItem, BaseHistorizedItem, OwnPerms, ValueGetter, ), "signature_date": "signature_date", "year": "signature_date__year", + "editors__person_id": "editors__person_id", # dynamic_table_documents } REVERSED_BOOL_FIELDS = [ "index__isnull", diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html index 2ce9e7eaa..b153e5795 100644 --- a/archaeological_operations/templates/ishtar/sheet_site.html +++ b/archaeological_operations/templates/ishtar/sheet_site.html @@ -166,7 +166,6 @@ {% if item.history_creator or item.last_edition_date or item.created or item.editors.count %} <h3>{% trans "Sheet"%}</h3> <div class="row"> - {% field_flex_multiple _("Editors") item.editors %} {% include "ishtar/blocks/sheet_creation_section.html" %} </div> {% endif %} diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index f0ec997fe..6c05a3aa0 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -317,6 +317,7 @@ class Warehouse( "warehouse_type__label": "warehouse_type__label", # used by dynamic_table_documents "person_in_charge__pk": "person_in_charge__pk", + "editors__person_id": "editors__person_id", # dynamic_table_documents } # alternative names of fields for searches ALT_NAMES = { @@ -910,6 +911,7 @@ class Container( "container_type__label": "container_type__label", # dynamic tables "container_tree_child__container_parent__id": "container_tree_child__container_parent__id", + "editors__person_id": "editors__person_id", # dynamic_table_documents } COL_LABELS = { "cached_location": _("Location - index"), diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 0d9155aef..af78961a3 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3388,6 +3388,51 @@ class Person(Address, Merge, OwnPerms, ValueGetter, MainItem): ] return slugify("-".join(values)) + @property + def file_edited(self): + model = apps.get_model("archaeological_files", "File") + return model.objects.filter(editors__person_id=self.pk) + + @property + def operation_edited(self): + model = apps.get_model("archaeological_operations", "Operation") + return model.objects.filter(editors__person_id=self.pk) + + @property + def site_edited(self): + model = apps.get_model("archaeological_operations", "ArchaeologicalSite") + return model.objects.filter(editors__person_id=self.pk) + + @property + def adminact_edited(self): + model = apps.get_model("archaeological_operations", "AdministrativeAct") + return model.objects.filter(editors__person_id=self.pk) + + @property + def context_record_edited(self): + model = apps.get_model("archaeological_context_records", "ContextRecord") + return model.objects.filter(editors__person_id=self.pk) + + @property + def find_edited(self): + model = apps.get_model("archaeological_finds", "Find") + return model.objects.filter(editors__person_id=self.pk) + + @property + def treatment_edited(self): + model = apps.get_model("archaeological_finds", "Treatment") + return model.objects.filter(editors__person_id=self.pk) + + @property + def container_edited(self): + model = apps.get_model("archaeological_warehouse", "Container") + return model.objects.filter(editors__person_id=self.pk) + + @property + def warehouse_edited(self): + model = apps.get_model("archaeological_warehouse", "Warehouse") + return model.objects.filter(editors__person_id=self.pk) + def docs_q(self): return Document.objects.filter(authors__person=self) diff --git a/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html b/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html index fb011dedc..3d1011af1 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_creation_section.html @@ -1,4 +1,5 @@ -{% load i18n link_to_window %} +{% load i18n link_to_window window_field %} +{% field_flex_detail_multiple _("Editors") item.editors %} {% if not is_external %} {% if item.history_creator.ishtaruser.person %} <div class="col-12 col-md-6 col-lg-3 flex-wrap text-muted" diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index d8f07ac2b..aa682b31d 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -10,13 +10,13 @@ {% block content %} <div class="row"> - {% field_flex "Title" item.full_title %} - {% field_flex "Name" item.name %} - {% field_flex "Surname" item.surname %} - {% field_flex "Raw name" item.raw_name %} - {% field_flex "Email" item.email %} - {% field_flex "Type(s)" item.person_types_list %} - {% field_flex_detail_multiple "Biographical notes" item.biographical_notes %} + {% field_flex _("Title") item.full_title %} + {% field_flex _("Name") item.name %} + {% field_flex _("Surname") item.surname %} + {% field_flex _("Raw name") item.raw_name %} + {% field_flex _("Email") item.email %} + {% field_flex _("Type(s)") item.person_types_list %} + {% field_flex_detail_multiple _("Biographical notes") item.biographical_notes %} {% if ADMIN %} {% field_flex_detail _("Account") item.ishtaruser %} {% endif %} @@ -51,9 +51,9 @@ {% if item.address or item.postal_code or item.town or item.precise_town %} <h3>{% trans "Business address" %}</h3> <div class="row"> - {% field_flex "Address" item.address %} - {% field_flex "Address complement" item.address_complement %} - {% field_flex "Postal code" item.postal_code %} + {% field_flex _("Address") item.address %} + {% field_flex _("Address complement") item.address_complement %} + {% field_flex _("Postal code") item.postal_code %} {% field_flex _("Town (freeform)") item.town %} {% field_flex_detail _("Town") item.precise_town %} </div>{% endif %} @@ -61,26 +61,25 @@ {% if item.alt_address or item.alt_postal_code or item.alt_town %} <h3>{% trans "Other address" %}</h3> <div class="row"> - {% field_flex "Address" item.alt_address %} - {% field_flex "Address complement" item.alt_address_complement %} - {% field_flex "Postal code" item.alt_postal_code %} - {% field_flex "Town" item.alt_town %} + {% field_flex _("Address") item.alt_address %} + {% field_flex _("Address complement") item.alt_address_complement %} + {% field_flex _("Postal code") item.alt_postal_code %} + {% field_flex _("Town") item.alt_town %} </div>{% endif %} {% if item.attached_to %}<h3>{% trans "Associated organization"%}</h3> <div class="row"> - {% field_flex_detail "Name" item.attached_to %} - {% field_flex "Address" item.attached_to.address %} - {% field_flex "Address complement" item.attached_to.address_complement %} - {% field_flex "Postal code" item.attached_to.postal_code %} + {% field_flex_detail _("Name") item.attached_to %} + {% field_flex _("Address") item.attached_to.address %} + {% field_flex _("Address complement") item.attached_to.address_complement %} + {% field_flex _("Postal code") item.attached_to.postal_code %} {% field_flex _("Town (freeform)") item.attached_to.town %} {% field_flex_detail _("Town") item.attached_to.precise_town %} - {% field_flex "Phone" item.attached_to.phone %} - {% field_flex "Mobile phone" item.attached_to.mobile_phone %} + {% field_flex _("Phone") item.attached_to.phone %} + {% field_flex _("Mobile phone") item.attached_to.mobile_phone %} </div>{% endif %} - {% trans "Associated operations as scientist" as ao %} {% if item.operation_scientist_responsability.count %} {% dynamic_table_document ao 'operations' 'scientist__pk' item.pk '' output %} @@ -173,6 +172,42 @@ {% dynamic_table_document docs 'documents' 'authors__person__pk' item.pk '' output %} {% endif %} +{% if item.file_edited.count %} +{% dynamic_table_document _("Edited file sheets") 'files' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.site_edited.count %} +{% dynamic_table_document _("Edited site sheets") 'sites' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.operation_edited.count %} +{% dynamic_table_document _("Edited operation sheets") 'operations' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.context_record_edited.count %} +{% dynamic_table_document _("Edited context record sheets") 'context_records' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.find_edited.count %} +{% dynamic_table_document _("Edited find sheets") 'finds' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.treatment_edited.count %} +{% dynamic_table_document _("Edited treatement sheets") 'treatments' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.warehouse_edited.count %} +{% dynamic_table_document _("Edited warehouse sheets") 'warehouses' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.container_edited.count %} +{% dynamic_table_document _("Edited container sheets") 'containers' 'editors__person_id' item.pk '' output %} +{% endif %} + +{% if item.adminact_edited.count %} +{% dynamic_table_document _("Edited administrative act sheets") 'admin_acts' 'editors__person_id' item.pk '' output %} +{% endif %} + {% if not is_external %} {% if item.history_creator or item.last_edition_date or item.created %} <h3>{% trans "Sheet"%}</h3> @@ -182,5 +217,4 @@ {% endif %} {% endif %} - {% endblock %} diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 66fe1ae36..7f688074e 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -506,6 +506,11 @@ urlpatterns += [ views.show_person, name="show-person", ), + re_path( + r"show-author(?:/(?P<pk>.+))?/(?P<type>.+)?$", + views.show_author, + name="show-author", + ), path( "show-ishtaruser/", check_permissions(["ishtaradmin"])(views.show_ishtaruser), diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 693562bd8..e219e5633 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1246,6 +1246,18 @@ show_ishtaruser = show_item(models.IshtarUser, "ishtaruser", callback=get_ishtar show_biographical_note = show_item(models.BiographicalNote, "biographicalnote") +def show_author(request, pk, **dct): + """ + Redirect to the person sheet. + Permissions are managed in the show_person view + """ + try: + author = models.Author.objects.get(pk=pk) + except models.Author.DoesNotExist: + raise Http404() + return show_person(request, author.person_id, **dct) + + def show_qualified_biographical_note(request, pk, **dct): q = models.QualifiedBiographicalNote.objects.filter(pk=pk) if not q.exists(): |
