Example #1
0
def index(request):
    """
    Show transit information
    """

    pathbar = Pathbar()
    # pathbar.append(_("Transit information") , 'gogogo.views.transit.index',None)

    loader = ListLoader(Agency)
    loader.load()

    data = loader.get_data()
    agency_list = []
    for agency in data:
        entity = createEntity(agency)
        entity = trEntity(entity, request)
        entity["type_name"] = TransitTypeProperty.get_type_name(entity["type"])

        agency_list.append(entity)

    return render_to_response(
        request,
        "gogogo/transit/index.html",
        {
            "page_title": _("Transit information"),
            "pathbar": pathbar,
            "model_kind": "agency",
            "agency_list": agency_list,
            "agency_type_name_list": TransitTypeProperty.get_basic_type_name_list(),
        },
    )
Example #2
0
def list_trip(request):
    if "id" not in request.GET:
        return ApiResponse(error="ID missing")    
        
    id = request.GET['id']
    
    loader = StopLoader(id)
    loader.load()
    
    trip_id_list = loader.get_trip_id_list()
    
    return ApiResponse(data=trip_id_list)