diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-23 14:43:48 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-23 14:43:48 +0200 |
commit | f5fc6f23f5369df98fb0fdb061bfbac3c9662677 (patch) | |
tree | 2abd184b08e73352ccb9ddb078b1d48122b5e472 /archaeological_operations/models.py | |
parent | d267f410a54aa76b7f9fe02cd754a270f56b3a04 (diff) | |
download | Ishtar-f5fc6f23f5369df98fb0fdb061bfbac3c9662677.tar.bz2 Ishtar-f5fc6f23f5369df98fb0fdb061bfbac3c9662677.zip |
Hide parcel field for UE QA - Add cultural atribution for sites
Diffstat (limited to 'archaeological_operations/models.py')
-rw-r--r-- | archaeological_operations/models.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 55594bcd9..d452bbb39 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -41,7 +41,8 @@ from ishtar_common.models import BaseHistorizedItem, Dashboard, \ post_delete_record_relation, post_save_cache, RelationItem, \ ShortMenuItem, SourceType, Town, ValueGetter, get_current_profile, \ document_attached_changed, HistoryModel, SearchAltName, \ - GeoItem, QRCodeItem, SearchVectorConfig, DocumentItem, QuickAction, MainItem + GeoItem, QRCodeItem, SearchVectorConfig, DocumentItem, QuickAction, \ + MainItem, HierarchicalType from ishtar_common.model_managers import UUIDModelManager from ishtar_common.utils import cached_label_changed, \ force_cached_label_changed, mode, m2m_historization_changed, post_save_geo @@ -106,6 +107,15 @@ class RecordQualityType(GeneralType): ordering = ('order',) +class CulturalAttributionType(HierarchicalType): + order = models.IntegerField(_("Order")) + + class Meta: + verbose_name = _("Cultural attribution type") + verbose_name_plural = _("Cultural attribution types") + ordering = ('order',) + + post_save.connect(post_save_cache, sender=RecordQualityType) post_delete.connect(post_save_cache, sender=RecordQualityType) @@ -242,6 +252,10 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, pgettext_lazy("key for text search", "numero-affmar"), 'affmar_number__iexact' ), + 'cultural_attributions': SearchAltName( + pgettext_lazy("key for text search", "cultural-attribution'"), + 'cultural_attributions__label__iexact' + ), } ALT_NAMES.update(BaseHistorizedItem.ALT_NAMES) @@ -252,7 +266,7 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, RELATIVE_SESSION_NAMES = [ ('operation', 'operations__pk'), ] - HISTORICAL_M2M = ['periods', 'remains', 'towns'] + HISTORICAL_M2M = ['periods', 'remains', 'towns', 'cultural_attributions'] CACHED_LABELS = ['cached_label', 'cached_towns_label', 'cached_periods', 'cached_remains'] DOWN_MODEL_UPDATE = ["context_records"] @@ -275,6 +289,9 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem, blank=True) remains = models.ManyToManyField("RemainType", verbose_name=_(u'Remains'), blank=True) + cultural_attributions = models.ManyToManyField( + "CulturalAttributionType", verbose_name=_("Cultural attribution"), + blank=True) towns = models.ManyToManyField(Town, verbose_name=_("Towns"), related_name='sites', blank=True) comment = models.TextField(_("Comment"), null=True, blank=True) |