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 | 4da911ec7b5625d5db4ffb0c9c0d71b11e50b058 (patch) | |
tree | cbaf81e617105e86e062db819512b1a77e0b7d3c | |
parent | 50fefcbf421f60e1f4e92aeafa83ad949a19e9db (diff) | |
download | Ishtar-4da911ec7b5625d5db4ffb0c9c0d71b11e50b058.tar.bz2 Ishtar-4da911ec7b5625d5db4ffb0c9c0d71b11e50b058.zip |
Templates: add finds to containers
-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 |