Exemplo n.º 1
0
def make_test_trip():
    from models import Trip
    import datetime
    trip = Trip()
    trip.start_location = "Here"
    trip.end_location = "There"

    trip.start_datetime = datetime.datetime.now()
    trip.end_datetime = datetime.datetime.now()

    trip.save()
Exemplo n.º 2
0
def insert_trip(trip_id, route_id, service_id, shape_id):
    """
    insert a new trip
    :param trip_id: str, id of trip
    :param route_id: str, id of route
    :param service_id: str, id of service,
    :param shape_id: str, id of shape
    :return:
    """
    route = Route.objects.get(route_id=route_id)
    service = Calender.objects.get(service_id=service_id)
    shape = Shape.objects.get(shape_id=shape_id)

    d = Trip(trip_id=trip_id,
             route_id=route,
             service_id=service,
             shape_id=shape)
    d.save()