diff --git a/pandora/place/managers.py b/pandora/place/managers.py index 65f20f3b..12bde750 100644 --- a/pandora/place/managers.py +++ b/pandora/place/managers.py @@ -31,6 +31,9 @@ def parseCondition(condition, user): exclude = True else: exclude = False + if op == '-': + return parseCondition({'key': k, 'value': v[0], 'operator': '>='}, user) \ + & parseCondition({'key': k, 'value': v[1], 'operator': '<'}, user) if k == 'id': v = v.split('/') if len(v) == 2: @@ -40,7 +43,7 @@ def parseCondition(condition, user): return q if isinstance(v, bool): #featured and public flag key = k - elif key in ('lat', 'lng', 'area', 'south', 'west', 'north', 'east', 'matches'): + elif k in ('lat', 'lng', 'area', 'south', 'west', 'north', 'east', 'matches'): if op == '>': key = '%s__gt'%k elif op == '>=': @@ -49,7 +52,8 @@ def parseCondition(condition, user): key = '%s__lt'%k elif op == '<=': key = '%s__lte'%k - #default is exact match + else: #default is exact match + key = k else: if op == '=': key = '%s__iexact'%k diff --git a/static/js/pandora/ui/placesDialog.js b/static/js/pandora/ui/placesDialog.js index 87c063ea..c2c82da1 100644 --- a/static/js/pandora/ui/placesDialog.js +++ b/static/js/pandora/ui/placesDialog.js @@ -16,9 +16,9 @@ pandora.ui.placesDialog = function() { content: app.$ui.placesElement = new Ox.ListMap({ height: height - 48, places: function(data, callback) { - return pandora.api.findPlaces($.extend(data, { + return pandora.api.findPlaces($.extend({ query: {conditions: [], operator: ''} - }), callback); + }, data), callback); }, addPlace: function(data, callback) { Ox.print('ADDPLACE', data); @@ -34,7 +34,10 @@ pandora.ui.placesDialog = function() { }, removePlace: function(data, callback) { Ox.print('REMOVEPLACE', data); - pandora.api.removePlace(data.id, callback); + pandora.api.removePlace(data.place, function(result) { + Ox.Request.clearCache(); // fixme: remove + callback(result); + }); }, width: width }),