From c01bb87c1368a64858a979922ffbfed4785a2341 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 1 Jun 2011 22:47:15 +0000 Subject: [PATCH] minor changes for filter dialog --- pandora/place/models.py | 5 +++++ pandora/place/views.py | 4 ++-- static/js/pandora/ui/filter.js | 4 ++-- static/js/pandora/ui/filterDialog.js | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pandora/place/models.py b/pandora/place/models.py index 5be20b849..9dfec291c 100644 --- a/pandora/place/models.py +++ b/pandora/place/models.py @@ -71,10 +71,15 @@ class Place(models.Model): return j def update_matches(self): + """ + import random + self.matches = random.randint(0, 100) + """ q = Q(value__icontains=self.name) for name in self.alternativeNames: q = q|Q(value__icontains=name) self.matches = Annotation.objects.filter(q).count() + self.save() def save(self, *args, **kwargs): diff --git a/pandora/place/views.py b/pandora/place/views.py index 1182552fe..ed6b8cbb2 100644 --- a/pandora/place/views.py +++ b/pandora/place/views.py @@ -52,7 +52,7 @@ def addPlace(request): value = tuple(value) setattr(place, key, value) place.save() - tasks.update_matches.delay(place.id) + #tasks.update_matches.delay(place.id) response = json_response(place.json()) else: response = json_response(status=403, text='place name exists') @@ -91,7 +91,7 @@ def editPlace(request): value = tuple(value) setattr(place, key, value) place.save() - tasks.update_matches.delay(place.id) + #tasks.update_matches.delay(place.id) response = json_response(place.json()) else: response = json_response(status=403, text='place name/geoname conflict') diff --git a/static/js/pandora/ui/filter.js b/static/js/pandora/ui/filter.js index 3c1417841..fac2f5765 100644 --- a/static/js/pandora/ui/filter.js +++ b/static/js/pandora/ui/filter.js @@ -1,8 +1,8 @@ // vim: et:ts=4:sw=4:sts=4:ft=js pandora.ui.filter = function() { var that = new Ox.Filter({ - findKeys: $.map(app.site.itemKeys, function(key) { - return { + findKeys: Ox.map(app.site.itemKeys, function(key) { + return key.id == 'all' ? null : { autocomplete: key.autocomplete, autocompleteSortKey: key.autocompleteSortKey, format: key.format, diff --git a/static/js/pandora/ui/filterDialog.js b/static/js/pandora/ui/filterDialog.js index c30ca0d7d..73ca74854 100644 --- a/static/js/pandora/ui/filterDialog.js +++ b/static/js/pandora/ui/filterDialog.js @@ -34,7 +34,7 @@ pandora.ui.filterDialog = function() { height: 264, keys: {enter: 'save', escape: 'cancel'}, title: 'Advanced Find', - width: 616 + Ox.UI.SCROLLBAR_SIZE + width: 648 + Ox.UI.SCROLLBAR_SIZE }); return that; };