def school_crossing(request, school_id, street, query=None):
    """
    Returns list of unique streets within 5000 meters of school crossing
    another street, by name
    """

    school = School.objects.get(pk=school_id)
    intersections = school.get_intersections()

    streets = intersections.filter(st_name_1__iexact=street).values('st_name_2').distinct()

    if query is not None and query.strip() != '':
        streets = streets.filter(st_name_2__icontains=query)

    data = [row['st_name_2'].title() for row in list(streets)]

    return HttpResponse(simplejson.dumps(data), mimetype='application/json')