minor changes for filter dialog
This commit is contained in:
parent
6d55cd1de3
commit
da65166776
4 changed files with 10 additions and 5 deletions
|
@ -71,10 +71,15 @@ class Place(models.Model):
|
||||||
return j
|
return j
|
||||||
|
|
||||||
def update_matches(self):
|
def update_matches(self):
|
||||||
|
"""
|
||||||
|
import random
|
||||||
|
self.matches = random.randint(0, 100)
|
||||||
|
"""
|
||||||
q = Q(value__icontains=self.name)
|
q = Q(value__icontains=self.name)
|
||||||
for name in self.alternativeNames:
|
for name in self.alternativeNames:
|
||||||
q = q|Q(value__icontains=name)
|
q = q|Q(value__icontains=name)
|
||||||
self.matches = Annotation.objects.filter(q).count()
|
self.matches = Annotation.objects.filter(q).count()
|
||||||
|
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
|
|
@ -52,7 +52,7 @@ def addPlace(request):
|
||||||
value = tuple(value)
|
value = tuple(value)
|
||||||
setattr(place, key, value)
|
setattr(place, key, value)
|
||||||
place.save()
|
place.save()
|
||||||
tasks.update_matches.delay(place.id)
|
#tasks.update_matches.delay(place.id)
|
||||||
response = json_response(place.json())
|
response = json_response(place.json())
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='place name exists')
|
response = json_response(status=403, text='place name exists')
|
||||||
|
@ -91,7 +91,7 @@ def editPlace(request):
|
||||||
value = tuple(value)
|
value = tuple(value)
|
||||||
setattr(place, key, value)
|
setattr(place, key, value)
|
||||||
place.save()
|
place.save()
|
||||||
tasks.update_matches.delay(place.id)
|
#tasks.update_matches.delay(place.id)
|
||||||
response = json_response(place.json())
|
response = json_response(place.json())
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='place name/geoname conflict')
|
response = json_response(status=403, text='place name/geoname conflict')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=js
|
// vim: et:ts=4:sw=4:sts=4:ft=js
|
||||||
pandora.ui.filter = function() {
|
pandora.ui.filter = function() {
|
||||||
var that = new Ox.Filter({
|
var that = new Ox.Filter({
|
||||||
findKeys: $.map(app.site.itemKeys, function(key) {
|
findKeys: Ox.map(app.site.itemKeys, function(key) {
|
||||||
return {
|
return key.id == 'all' ? null : {
|
||||||
autocomplete: key.autocomplete,
|
autocomplete: key.autocomplete,
|
||||||
autocompleteSortKey: key.autocompleteSortKey,
|
autocompleteSortKey: key.autocompleteSortKey,
|
||||||
format: key.format,
|
format: key.format,
|
||||||
|
|
|
@ -34,7 +34,7 @@ pandora.ui.filterDialog = function() {
|
||||||
height: 264,
|
height: 264,
|
||||||
keys: {enter: 'save', escape: 'cancel'},
|
keys: {enter: 'save', escape: 'cancel'},
|
||||||
title: 'Advanced Find',
|
title: 'Advanced Find',
|
||||||
width: 616 + Ox.UI.SCROLLBAR_SIZE
|
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
||||||
});
|
});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue