summaryrefslogtreecommitdiff
path: root/ishtar_common/views_item.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/views_item.py')
-rw-r--r--ishtar_common/views_item.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 2018f6f90..1d3d55a5c 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -549,6 +549,23 @@ def get_item(model, func_name, default_name, extra_request_keys=[],
dct.pop(k)
# manage hierarchic conditions
for req in dct.copy():
+ if req.endswith('areas__pk'):
+ val = dct.pop(req)
+ reqs = Q(**{req: val})
+ base_req = req[:-2] + '__'
+ req = base_req[:]
+ for idx in range(HIERARCHIC_LEVELS):
+ req = req[:-2] + 'parent__pk'
+ q = Q(**{req: val})
+ reqs |= q
+ req = base_req[:]
+ for idx in range(HIERARCHIC_LEVELS):
+ req = req[:-2] + 'children__pk'
+ q = Q(**{req: val})
+ reqs |= q
+ and_reqs.append(reqs)
+ continue
+
if req.endswith('town__pk') or req.endswith('towns__pk'):
val = dct.pop(req)
reqs = Q(**{req: val})