def origins(request): airport_list = Airport.objects.all().order_by('iataCode') return render_to_response('search/search_origins.html', { 'page_title': "Origin", 'airport_list': airport_list, })
def form(request, origin=None, destination=None): return render_to_response('search/search_form.html', { 'page_title': "Search", 'origin': origin, 'destination': destination, 'max_hops': MAX_HOPS, })
def update(request, iataCode=None): flights = [] if request.method == 'POST': flights = getSchedule(iataCode) for flight in flights: origin = Airport.objects.get(pk=flight['origin']) destination = Airport.objects.get(pk=flight['destination']) flightNum = flight['flightNum'] fromDate = datetime.strptime(flight['fromDate'], "%B %d, %Y") toDate = datetime.strptime(flight['toDate'], "%B %d, %Y") skd = datetime.strptime(flight['ska'], "%I:%M%p") ska = datetime.strptime(flight['skd'], "%I:%M%p") f = Flight.objects.get_or_create( origin=origin, destination=destination, flightNum=flightNum, fromDate=fromDate, toDate=toDate, skd=skd, ska=ska ) return render_to_response('schedule/schedule_update.html', { 'flights': flights })
def destinations(request, origin=None): airport_list = Airport.objects.all().order_by('iataCode') return render_to_response('search/search_destinations.html', { 'page_title': "Destination", 'origin': origin, 'airport_list': airport_list, })
def result(request, origin=None, destination=None): if request.method == 'POST': o = Airport.objects.get(pk=origin) d = Airport.objects.get(pk=destination) flights = Flight.objects.filter(origin=o, destination=d) return render_to_response('search/search_result.html', { 'flights': flights })
def update_airports(request): doc = parse(AIRPORT_URL).getroot() # timezones = getTimezones() for row in CITY_ROWS(doc): iataCode = STATION_ID_DIV(row)[0].text name = AIRPORT_NAME_DIV(row)[0].text # tz_offset = timezones[iataCode]['offset'] # dst = timezones[iataCode]['offset'] airport = Airport.objects.get_or_create(iataCode=iataCode, name=name) print airport Airport.objects return render_to_response('schedule/schedule_update_airports.html', { 'airports': Airport.objects.all() })
def update_timezones(request): timezones = updateTimezones() return render_to_response('schedule/schedule_update_timezones.html', { 'timezones': timezones })
def form(request, iataCode=None): return render_to_response('schedule/schedule_form.html', { 'iataCode': iataCode, })
def airports(request): airport_list = Airport.objects.all().order_by('iataCode') return render_to_response('schedule/schedule_airports.html', { 'airport_list': airport_list })
def index(request): return render_to_response('schedule/index.html')