diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-12-31 11:31:20 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:23 +0100 |
commit | 0d38c926aa368e4f0401b8d20cc6c05bdabcbc45 (patch) | |
tree | cbaf81e617105e86e062db819512b1a77e0b7d3c /archaeological_warehouse | |
parent | 39476e1854e9e0e5b3ad3ff2a2eb44e03620a693 (diff) | |
download | Ishtar-0d38c926aa368e4f0401b8d20cc6c05bdabcbc45.tar.bz2 Ishtar-0d38c926aa368e4f0401b8d20cc6c05bdabcbc45.zip |
Templates: add finds to containers
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r-- | archaeological_warehouse/models.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 80774e31c..06944fa38 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -1306,6 +1306,17 @@ class Container(DocumentItem, Merge, LightHistorizedItem, return self.set_static_localisation(8, value) set_static_localisation_9.post_save = True + def get_values(self, prefix='', no_values=False, filtr=None, **kwargs): + values = super(Container, self).get_values( + prefix=prefix, no_values=no_values, filtr=filtr, **kwargs) + + if not filtr or prefix + 'finds' in filtr: + values[prefix + 'finds'] = [ + f.get_values( + prefix=prefix, no_values=True, filtr=None, **kwargs) + for f in self.finds.distinct().all()] + return values + def get_extra_actions(self, request): """ extra actions for the sheet template |