From 9f88fca5528b76f3493a0a5b5e5d14e030b2dcf8 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 22 May 2026 09:54:12 +0200 Subject: ✨ improvements for templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add fields for document - defaut inititialization (prevent crash when indexing a list) - add a hierarchy variable for document source types --- archaeological_warehouse/models.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'archaeological_warehouse') diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 35ef88147..093d56656 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1322,6 +1322,22 @@ class Container( def natural_key(self): return (self.uuid,) + @property + def location_lbl(self): + return str(self.location or "") + + @property + def responsability_lbl(self): + return str(self.responsibility or "") + + def get_values(self, prefix="", no_values=False, filtr=None, **kwargs): + if "simple" in kwargs: + keys = ["reference", "container_type", "code", "cached_location", + "cached_location", "index", "custom_index", "complete_identifier", + "responsability_lbl", "location_lbl"] + return self._get_values(keys, prefix=prefix, filtr=filtr, **kwargs) + return super().get_values(prefix, no_values, filtr, **kwargs) + @classmethod @pre_importer_action def import_get_location(cls, context, value): -- cgit v1.2.3