From 02199613105a469ace3deea80dcd2576f39930b9 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 9 Dec 2019 11:15:29 +0100 Subject: Site: add other reference --- archaeological_operations/forms.py | 6 ++++++ .../migrations/0073_auto_20191209_1058.py | 25 ++++++++++++++++++++++ archaeological_operations/models.py | 7 ++++++ .../templates/ishtar/sheet_site.html | 3 ++- 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 archaeological_operations/migrations/0073_auto_20191209_1058.py (limited to 'archaeological_operations') diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 32ec6f826..18534fe9d 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1221,6 +1221,8 @@ class ArchaeologicalSiteForm(ManageOldType): HEADERS = {} reference = forms.CharField(label=_(u"Reference"), max_length=200) name = forms.CharField(label=_(u"Name"), max_length=200, required=False) + other_reference = forms.CharField(label=_(u"Other reference"), + required=False) periods = forms.MultipleChoiceField( label=_("Periods"), choices=[], widget=widgets.Select2Multiple, required=False) @@ -1374,6 +1376,8 @@ class SiteSelect(HistorySelect): reference = forms.CharField(label=_(u"Reference"), max_length=200, required=False) name = forms.CharField(label=_(u"Name"), max_length=200, required=False) + other_reference = forms.CharField(label=_("Other reference"), + max_length=200, required=False) periods = forms.ChoiceField(label=_(u"Periods"), choices=[], required=False) remains = forms.ChoiceField(label=_(u"Remains"), choices=[], required=False) cultural_attributions = forms.ChoiceField( @@ -1487,6 +1491,8 @@ class SiteForm(CustomForm, ManageOldType): pk = forms.IntegerField(required=False, widget=forms.HiddenInput) reference = forms.CharField(label=_(u"Reference"), max_length=200) name = forms.CharField(label=_(u"Name"), max_length=200, required=False) + other_reference = forms.CharField(label=_("Other reference"), + required=False) period = forms.MultipleChoiceField( label=_("Periods"), choices=[], widget=widgets.Select2Multiple, required=False) diff --git a/archaeological_operations/migrations/0073_auto_20191209_1058.py b/archaeological_operations/migrations/0073_auto_20191209_1058.py new file mode 100644 index 000000000..53049837c --- /dev/null +++ b/archaeological_operations/migrations/0073_auto_20191209_1058.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-12-09 10:58 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archaeological_operations', '0072_create_view'), + ] + + operations = [ + migrations.AddField( + model_name='archaeologicalsite', + name='other_reference', + field=models.TextField(blank=True, null=True, verbose_name='Other reference'), + ), + migrations.AddField( + model_name='historicalarchaeologicalsite', + name='other_reference', + field=models.TextField(blank=True, null=True, verbose_name='Other reference'), + ), + ] diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 024886c72..81dd076a8 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -155,6 +155,7 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, SearchVectorConfig("name"), SearchVectorConfig("oceanographic_service_localisation"), SearchVectorConfig("reference"), + SearchVectorConfig("other_reference"), SearchVectorConfig("shipwreck_code"), SearchVectorConfig("shipwreck_name"), SearchVectorConfig("drassm_number"), @@ -187,6 +188,10 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, pgettext_lazy("key for text search", "name"), 'name__iexact' ), + 'other_reference': SearchAltName( + pgettext_lazy("key for text search", "other-reference"), + 'other_reference__iexact' + ), 'periods': SearchAltName( pgettext_lazy("key for text search", "period"), 'periods__label__iexact' @@ -283,6 +288,8 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, objects = SiteManager() reference = models.CharField(_("Reference"), max_length=200, unique=True) + other_reference = models.TextField(_("Other reference"), blank=True, + null=True) name = models.CharField(_("Name"), max_length=200, null=True, blank=True) periods = models.ManyToManyField(Period, verbose_name=_("Periods"), diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html index 91e6e7307..a69d61a13 100644 --- a/archaeological_operations/templates/ishtar/sheet_site.html +++ b/archaeological_operations/templates/ishtar/sheet_site.html @@ -33,12 +33,13 @@

{% trans "General"%}

- {% include "ishtar/blocks/sheet_creation_section.html" %} + {% field_flex "Other reference" item.other_reference %} {% field_flex_multiple_obj "Periods" item 'periods' %} {% field_flex_multiple_obj "Remains" item 'remains' %} {% field_flex_multiple_obj "Cultural attributions" item 'cultural_attributions' %} {% field_flex_multiple "Collaborators" item.collaborators %} {% field_flex_full "Comment" item.comment "
" "
" %} + {% include "ishtar/blocks/sheet_creation_section.html" %}
{% if item.affmar_number or item.drassm_number or item.oceanographic_service_localisation or item.shipwreck_code or item.sinking_date or item.discovery_area or item.shipwreck_name %} -- cgit v1.2.3