diff options
-rw-r--r-- | archaeological_finds/forms.py | 2 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 6 | ||||
-rw-r--r-- | archaeological_finds/templates/ishtar/sheet_museum_find.html | 13 | ||||
-rw-r--r-- | changelog/en/changelog_2022-06-15.md | 1 | ||||
-rw-r--r-- | changelog/fr/changelog_2023-01-25.md | 3 | ||||
-rw-r--r-- | ishtar_common/admin.py | 13 | ||||
-rw-r--r-- | ishtar_common/models.py | 9 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_biographicalnote.html | 23 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_biographicalnote_pdf.html | 14 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_biographicalnote_window.html | 3 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_organization.html | 1 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/sheet_person.html | 1 | ||||
-rw-r--r-- | ishtar_common/urls.py | 5 | ||||
-rw-r--r-- | ishtar_common/views.py | 2 |
14 files changed, 85 insertions, 11 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index e30a7bc8d..21edb2eba 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -352,13 +352,13 @@ class BasicFindForm(CustomForm, ManageOldType): previous_id = forms.CharField(label=_("Previous ID"), required=False) laboratory_id = forms.CharField(label=_("Laboratory ID"), required=False) seal_number = forms.CharField(label=_("Seal number"), required=False) - mark = forms.CharField(label=_("Mark"), required=False) museum_inventory_marking_presence = widgets.Select2MultipleField( label=_("Presence of inventory marking"), required=False ) museum_marking_type = widgets.Select2MultipleField( label=_("Type of marking"), required=False ) + mark = forms.CharField(label=_("Marking details"), required=False) museum_marking_comment = forms.CharField( label=_("Comment on marking"), widget=forms.Textarea, required=False ) diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 030328d1d..68b845f59 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -2219,6 +2219,12 @@ class Find( from django.utils.formats import date_format if not self.museum_entry_date: return + if self.museum_entry_date and self.museum_entry_date_end and ( + self.museum_entry_date.year == self.museum_entry_date_end.year and + self.museum_entry_date.month == 1 and self.museum_entry_date_end.month == 12 and + self.museum_entry_date.day == 1 and self.museum_entry_date_end.day == 31 + ): + return self.museum_entry_date.year dates = [date_format(self.museum_entry_date, format='SHORT_DATE_FORMAT', use_l10n=True)] if self.museum_entry_date_end: dates.append(date_format(self.museum_entry_date_end, format='SHORT_DATE_FORMAT', use_l10n=True)) diff --git a/archaeological_finds/templates/ishtar/sheet_museum_find.html b/archaeological_finds/templates/ishtar/sheet_museum_find.html index e1c82d791..a3b60f7cd 100644 --- a/archaeological_finds/templates/ishtar/sheet_museum_find.html +++ b/archaeological_finds/templates/ishtar/sheet_museum_find.html @@ -145,10 +145,10 @@ {% if item.has_museum_section %} <h3>{% trans "Museum / legal status" %}</h3> <div class='row'> - {% field_flex "Museum ID prefix" item.museum_id_prefix %} - {% field_flex "Museum inventory number" item.museum_id %} - {% field_flex "Museum ID suffix" item.museum_id_suffix %} + {% field_flex "Complete museum ID" item.cache_complete_museum_id %} {% field_flex "Comment on museum ID" item.museum_id_comment %} + {% field_flex "Collection" item.museum_collection %} + {% field_flex_detail_multiple "Former collection" item.museum_former_collections %} {% field_flex_detail "Owner institution" item.museum_owner_institution %} {% field_flex_detail "Custodian institution" item.museum_custodian_institution %} {% field_flex "Depositor inventory number" item.museum_depositor_inventory_number %} @@ -157,15 +157,14 @@ {% trans "Museum entry date" as museum_entry_date_label %} {% field_flex museum_entry_date_label item.museum_entry_date_label %} {% field_flex "Comment on museum entry date" item.museum_entry_date_comment %} - {% field_flex "Name of donor, testator or vendor" item.museum_donor %} + {% field_flex_detail "Donor, testator or vendor" item.museum_donor %} {% field_flex_multiple_obj "Presence of inventory marking" item "museum_inventory_marking_presence" %} {% field_flex_multiple_obj "Type of marking" item "museum_marking_type" %} + {% field_flex "Marking details" item.mark "<pre>" "</pre>" %} {% field_flex "Comment on marking" item.museum_marking_comment %} - {% field_flex "Collection" item.museum_collection %} - {% field_flex_multiple_obj "Former collection" item "museum_former_collections" %} - {% field_flex "Inventory entry year" item.museum_inventory_entry_year %} {% field_flex "Conformity with inventory" item.museum_inventory_conformity %} {% field_flex "Comment of non-conformity" item.museum_non_conformity_comment %} + {% field_flex "Inventory entry year" item.museum_inventory_entry_year %} {% field_flex "Inventory transcript" item.museum_inventory_transcript %} {% field_flex "Original/reproduction" item.museum_original_repro %} {% field_flex "Date of museum allocation" item.museum_allocation_date|date:"SHORT_DATE_FORMAT" %} diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md index 322df00fd..e8e0d14a7 100644 --- a/changelog/en/changelog_2022-06-15.md +++ b/changelog/en/changelog_2022-06-15.md @@ -2,6 +2,7 @@ v4.0.XX - 2099-12-31 -------------------- - museum... +- biographical note ### Features/improvements ### diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md index 8289e0560..7ace2d486 100644 --- a/changelog/fr/changelog_2023-01-25.md +++ b/changelog/fr/changelog_2023-01-25.md @@ -2,6 +2,7 @@ v4.0.XX - 2099-12-31 -------------------- - musée... +- notices bio ### Fonctionnalités/améliorations ### - formulaire géographique : @@ -9,7 +10,7 @@ v4.0.XX - 2099-12-31 - obtention des coordonnées depuis la géolocalisation - fiche géographique: affichage du tampon du point - Contenant : nouveau champ Code (formulaires, fiche, index de recherche et autocomplétion) (#5704) -- Unité d'enregistrement +- Unité d'enregistrement : - type d'identification passe en hiérarchique (#5739) - ajout de l'attribution culturelle (#5740) diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index 527584f39..ae521729d 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -735,11 +735,24 @@ class PersonAdmin(HistorizedObjectAdmin): admin_site.register(models.Person, PersonAdmin) +MAIN_ITEM_READONLY_FIELDS = [ + "history_creator", + "history_modifier", + "search_vector", + "history_m2m", + "imports", + "imports_updated", + "timestamp_geo", + "timestamp_label", +] + + @admin.register(models.BiographicalNote, site=admin_site) class BiographicalNoteAdmin(admin.ModelAdmin): list_display = ("denomination", "last_name", "first_name") autocomplete_fields = ["person", "organization"] model = models.BiographicalNote + readonly_fields = MAIN_ITEM_READONLY_FIELDS @admin.register(models.GDPRLog, site=admin_site) diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 187df4126..a5e666b13 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3231,10 +3231,11 @@ def text_format(text, text_format): return mark_safe(markdown(text)) elif text_format == "HT": return mark_safe(bleach.clean(text)) - return text_format + return text class BiographicalNote(BaseHistorizedItem, ValueGetter, MainItem): + SLUG = "biographicalnote" denomination = models.TextField(_("Denomination")) last_name = models.TextField(_("Last name"), blank=True, default="") first_name = models.TextField(_("First name"), blank=True, default="") @@ -3244,10 +3245,14 @@ class BiographicalNote(BaseHistorizedItem, ValueGetter, MainItem): biography_format = models.CharField( _("Biography format"), blank=True, default="NO", max_length=2, choices=TEXT_FORMAT ) - person = models.ForeignKey(Person, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_("Person")) + person = models.ForeignKey( + Person, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_("Person"), + related_name="biographical_notes" + ) organization = models.ForeignKey( Organization, blank=True, null=True, on_delete=models.SET_NULL, verbose_name=_("Organization"), + related_name="biographical_notes" ) class Meta: diff --git a/ishtar_common/templates/ishtar/sheet_biographicalnote.html b/ishtar_common/templates/ishtar/sheet_biographicalnote.html new file mode 100644 index 000000000..64a6b4d9c --- /dev/null +++ b/ishtar_common/templates/ishtar/sheet_biographicalnote.html @@ -0,0 +1,23 @@ +{% extends "ishtar/sheet.html" %} +{% load i18n window_field window_tables window_header %} + +{% block head_title %}<strong>{% trans "Biographical note"%}</strong> - {{item}}{% endblock %} + +{% block toolbar %} +{% window_nav item window_id 'show-person' 'person_modify' %} +{% endblock %} + +{% block content %} + +<div class="row"> + {% field_flex "Denomination" item.denomination %} + {% field_flex "Last name" item.last_name %} + {% field_flex "First name" item.first_name %} + {% field_flex "Year of birth" item.birth_year %} + {% field_flex "Year of death" item.death_year %} + {% field_flex_detail "Person" item.person %} + {% field_flex_detail "Organization" item.organization %} + {% field_flex_full "Biography" item.formatted_biography %} +</div> + +{% endblock %} diff --git a/ishtar_common/templates/ishtar/sheet_biographicalnote_pdf.html b/ishtar_common/templates/ishtar/sheet_biographicalnote_pdf.html new file mode 100644 index 000000000..714277187 --- /dev/null +++ b/ishtar_common/templates/ishtar/sheet_biographicalnote_pdf.html @@ -0,0 +1,14 @@ +{% extends "ishtar/sheet_biographicalnote.html" %} +{% block header %} +{% endblock %} +{% block main_head %} +{{ block.super }} +<div id="pdfheader"> +Ishtar – {{APP_NAME}} – {{item}} +</div> +{% endblock %} +{%block head_sheet%}{%endblock%} +{%block main_foot%} +</body> +</html> +{%endblock%} diff --git a/ishtar_common/templates/ishtar/sheet_biographicalnote_window.html b/ishtar_common/templates/ishtar/sheet_biographicalnote_window.html new file mode 100644 index 000000000..29bbf0aa8 --- /dev/null +++ b/ishtar_common/templates/ishtar/sheet_biographicalnote_window.html @@ -0,0 +1,3 @@ +{% extends "ishtar/sheet_biographicalnote.html" %} +{% block main_head %}{%endblock%} +{% block main_foot %}{%endblock%} diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html index a3c923ab8..f2618bb58 100644 --- a/ishtar_common/templates/ishtar/sheet_organization.html +++ b/ishtar_common/templates/ishtar/sheet_organization.html @@ -16,6 +16,7 @@ {% include "ishtar/blocks/sheet_address_section.html" %} {% field_flex "Phone" item.phone %} {% field_flex "Mobile phone" item.mobile_phone %} + {% field_flex_detail_multiple "Biographical notes" item.biographical_notes %} </div> <h3>{%trans "Person in the organization"%}</h3> diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index 46639f248..53cd7d84f 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -17,6 +17,7 @@ {% field_flex_detail "Created by" item.history_creator.ishtaruser.person %} {% 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 "Profile(s)" item.profiles_list %} {% endif %} diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 86d10969d..5ce9861d1 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -405,6 +405,11 @@ urlpatterns += [ name="show-person", ), url( + r"show-biographicalnote(?:/(?P<pk>.+))?/(?P<type>.+)?$", + views.show_biographical_note, + name="show-biographicalnote", + ), + url( r"department-by-state/(?P<state_id>.+)?$", views.department_by_state, name="department-by-state", diff --git a/ishtar_common/views.py b/ishtar_common/views.py index bee4d6628..5ad14695f 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1136,6 +1136,8 @@ show_person = show_item(models.Person, "person", callback=get_person_gdpr_log) get_person = get_item(models.Person, "get_person", "person", callback=get_person_gdpr_log) +show_biographical_note = show_item(models.BiographicalNote, "biographicalnote") + get_person_for_account = get_item( models.Person, "get_person", |