bzr merge, dur
This commit is contained in:
commit
3a3e5d20f2
|
@ -51,7 +51,7 @@ class FareAdmin(admin.ModelAdmin):
|
|||
class UniqueRouteAdmin(admin.ModelAdmin):
|
||||
list_display = ("route","from_stop", "to_stop","distance","is_full")
|
||||
readonly_fields = ("route","from_stop", "to_stop","distance","is_full")
|
||||
search_fields = ("route", "from_stop__name", "to_stop__name")
|
||||
search_fields = ("route__alias", "from_stop__name", "to_stop__name")
|
||||
ordering = ('route',)
|
||||
list_per_page = 50
|
||||
|
||||
|
|
|
@ -29,28 +29,31 @@ def area(request, slug):
|
|||
})
|
||||
|
||||
def routes(request):
|
||||
qset = Route.objects.all()
|
||||
if request.GET.has_key('q'):
|
||||
q = request.GET.get('q', '')
|
||||
qset = qset.filter(alias__icontains=q) #FIXME: make a better Q object
|
||||
q = request.GET.get("q", "")
|
||||
if q != '':
|
||||
qset = Route.objects.filter(alias__icontains=q)
|
||||
else:
|
||||
qset = Route.objects.all()
|
||||
routes = [route.alias for route in qset]
|
||||
return render_to_json_response(routes)
|
||||
|
||||
|
||||
def areas(request):
|
||||
qset = Area.objects.all()
|
||||
if request.GET.has_key('q'):
|
||||
q = request.GET.get('q', '')
|
||||
qset = qset.filter(display_name__icontains=q)
|
||||
q = request.GET.get("q", "")
|
||||
if q != '':
|
||||
qset = Area.objects.find_approximate(q, 0.33)
|
||||
else:
|
||||
qset = Area.objects.all()
|
||||
areas = [area.slug for area in qset]
|
||||
return render_to_json_response(areas)
|
||||
|
||||
def stops(request):
|
||||
qset = Stop.objects.all()
|
||||
srid = int(request.GET.get("srid", 4326))
|
||||
if request.GET.has_key('q'):
|
||||
q = request.GET.get('q', '')
|
||||
qset = qset.filter(display_name__icontains=q) #FIXME: This definitely needs to be a Q object with OR lookups for area name, road name, etc.
|
||||
q = request.GET.get("q", "")
|
||||
if q != '':
|
||||
qset = Stop.objects.find_approximate(q, 0.33)
|
||||
else:
|
||||
qset = Stop.objects.all()
|
||||
srid = int(request.GET.get("srid", 4326))
|
||||
return render_to_json_response({
|
||||
'type': 'FeatureCollection',
|
||||
'features': [stop.get_geojson(srid=srid) for stop in qset]
|
||||
|
|
|
@ -23,7 +23,7 @@ var API_BASE = "/1.0/",
|
|||
var $li = $('<div />')
|
||||
.addClass("listItem")
|
||||
.appendTo($list);
|
||||
var $txt = $('<span >').addClass("listItemText").text(v).appendTo($li);
|
||||
var $txt = $('<span />').addClass("listItemText").text(v).appendTo($li);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ var API_BASE = "/1.0/",
|
|||
$('.selectedListItem').find(".stopsList").hide().remove();
|
||||
$('.selectedListItem').removeClass("selectedListItem");
|
||||
$target.addClass("selectedListItem");
|
||||
|
||||
if ($target.data("hasList")) {
|
||||
var $stopsList = $target.find(".stopsList");
|
||||
$stopsList.slideDown();
|
||||
|
|
Loading…
Reference in New Issue
Block a user