diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-03-09 12:13:49 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-03-09 12:13:49 +0100 |
commit | 2e2d42111a9fae88c174557db206fa08d3d24730 (patch) | |
tree | 647d244f3ec0ad095daa37b02b27aba3196bd067 /archaeological_finds | |
parent | f0df0225a3959895a9988d410fc78b377db296ed (diff) | |
download | Ishtar-2e2d42111a9fae88c174557db206fa08d3d24730.tar.bz2 Ishtar-2e2d42111a9fae88c174557db206fa08d3d24730.zip |
Templates: optimize template render for containers
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models_finds.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index c292cd368..933f14237 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1710,6 +1710,8 @@ class Find( "alteration_causes", "cultural_attributions", ] + GET_VALUES_EXTRA = ValueGetter.GET_VALUES_EXTRA + ["complete_id", + "context_record_label"] GET_VALUES_EXTRA_TYPES = ValueGetter.GET_VALUES_EXCLUDE_FIELDS + [ "material_types", "object_types", @@ -2096,6 +2098,24 @@ class Find( lbl += " ({})".format(base) return lbl + @property + def complete_id(self): + """ + Return complete id of associated base find + """ + return " ; ".join( + list(self.base_finds.values_list("cache_complete_id", flat=True)) + ) + + @property + def context_record_label(self): + """ + Return label of associated context records + """ + return " ; ".join( + list(self.base_finds.values_list("context_record__label", flat=True)) + ) + def get_first_base_find(self): if not self.base_finds.count(): return @@ -2106,6 +2126,8 @@ class Find( ("material_types_label", _("Material types string")), ("material_types_code", _("Material types code string")), ("material_types_recommendations", _("Recommendations string from material")), + ("complete_id", _("Complete ID of associated base finds")), + ("context_record_label", _("Label of associated context records")), ] def get_material_types_code(self) -> str: |