Example #1
0
def flight_add():
    if request.method == 'POST':
        plane_no = request.form['plane_no']
        source = request.form['source']
        destination = request.form['destination']
        plane_timing = request.form['plane_timing']
        total_seats = int(request.form['total_seats'])
        seats_booked = int(request.form['seats_booked'])
        airline_name = request.form['airline_name']
        price = int(request.form['price'])

        Flight(plane_no, source, destination, plane_timing, total_seats,
               seats_booked, airline_name, price).save_to_mongo()
        return redirect(url_for(".index"))
    return render_template('flights/new_flight.html')
Example #2
0
def flight_add():
    if request.method == 'POST':
        location = request.form['location']
        event_time = request.form['event_time']
        total_seats = int(request.form['total_seats'])
        seats_booked = int(request.form['seats_booked'])
        event_name = request.form['event_name']
        price = int(request.form['price'])

        Flight(location,
               event_time,
               total_seats,
               seats_booked,
               event_name,
               price,
               dates={}).save_to_mongo()
        return redirect(url_for(".index"))
    return render_template('flights/new_flight.html')