From 00c8f47541178254002d1fdee17ae2d08d46f7ac Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 2 Apr 2012 17:33:23 +0200 Subject: [PATCH] inbetween queries --- pandora/item/managers.py | 2 +- pandora/place/managers.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pandora/item/managers.py b/pandora/item/managers.py index ce567021e..d7a90c2c8 100644 --- a/pandora/item/managers.py +++ b/pandora/item/managers.py @@ -72,7 +72,7 @@ def parseCondition(condition, user): if exclude: q = ~q return q - elif isinstance(v, list) and len(v) == 2: + elif isinstance(v, list) and len(v) == 2 and op == '=': q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \ & parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user) if exclude: diff --git a/pandora/place/managers.py b/pandora/place/managers.py index 34ce2c261..6acbc647e 100644 --- a/pandora/place/managers.py +++ b/pandora/place/managers.py @@ -34,13 +34,12 @@ def parseCondition(condition, user): exclude = True else: exclude = False - if op == '-': + if isinstance(v, list) and len(v) == 2 and op == '=': q = parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \ & parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user) if exclude: - return ~q - else: - return q + q = ~q + return q if k == 'id': v = decode_id(v) if isinstance(v, bool): #featured and public flag