summaryrefslogtreecommitdiff
path: root/archaeological_warehouse
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_warehouse')
-rw-r--r--archaeological_warehouse/models.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 06c7cdcd8..cb144270b 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -651,6 +651,9 @@ class Container(DocumentItem, Merge, LightHistorizedItem,
STATISTIC_MODALITIES = [
key for key, lbl in STATISTIC_MODALITIES_OPTIONS.items()]
+ GET_VALUES_EXCLUDE_FIELDS = ValueGetter.GET_VALUES_EXCLUDE_FIELDS + [
+ "inside_container", "parent"]
+
# search parameters
EXTRA_REQUEST_KEYS = {
'location': 'location__pk',
@@ -1341,16 +1344,17 @@ class Container(DocumentItem, Merge, LightHistorizedItem,
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) and (
- not prefix.startswith("container_") and not
- prefix.startswith("container_ref_")):
+ from_find = prefix.startswith("container_") or \
+ prefix.startswith("container_ref_")
+ if (not filtr or prefix + 'finds' in filtr) and not from_find:
kwargs["exclude"] = [prefix + "container", prefix + "container_ref"]
# prevent recursive call
values[prefix + 'finds'] = [
f.get_values(
prefix=prefix, no_values=True, filtr=None, **kwargs)
for f in self.finds.distinct().all()]
- if (not filtr or prefix + 'operation' in filtr or
+ if not from_find and (
+ not filtr or prefix + 'operation' in filtr or
prefix + "context_record" in filtr) and self.finds.count():
# assume that only one operation is in this container
# you should know what you are doing when using theses variables