From 2ed6a707f55db7dcc1885bfbd33e902e238e67e1 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 20 Jun 2011 18:14:38 +0200 Subject: [PATCH] places --- pandora/annotation/managers.py | 7 ++++--- static/js/pandora/ui/list.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pandora/annotation/managers.py b/pandora/annotation/managers.py index c0377c0c..c4333182 100644 --- a/pandora/annotation/managers.py +++ b/pandora/annotation/managers.py @@ -20,7 +20,7 @@ def parseCondition(condition, user): k = condition.get('key', 'name') k = { 'user': 'user__username', - 'place': 'places__name', + 'place': 'places__id', }.get(k, k) if not k: k = 'name' @@ -40,11 +40,12 @@ def parseCondition(condition, user): return ~q else: return q - if k == 'id': + if k in ('id', 'places__id'): v = ox.from32(v) if isinstance(v, bool): #featured and public flag key = k - elif k in ('lat', 'lng', 'area', 'south', 'west', 'north', 'east', 'matches', 'id'): + elif k in ('lat', 'lng', 'area', 'south', 'west', 'north', 'east', 'matches', + 'id', 'places__id'): if op == '>': key = '%s__gt'%k elif op == '>=': diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index c5366b49..67338ab7 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -150,12 +150,12 @@ pandora.ui.list = function(view) { // fixme: remove view argument width: window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 2 - 144 - Ox.UI.SCROLLBAR_SIZE, }).bindEvent({ selectplace: function(event, place) { - if(place) { + if(place && place.id[0] != '_') { pandora.$ui.clips.options({ items: function(data, callback) { return pandora.api.findAnnotations($.extend(data, { query: { - conditions:[{key: 'place', value: place.name, operator:'='}] + conditions:[{key: 'place', value: place.id, operator:'='}] }, itemQuery: pandora.Query.toObject() }), callback);