Exemple #1
0
def aircraft(aircraft_id):
    try:
        # Mode 1 to read one instance, mode 2 to read all instances, mode 3 to search by operator contains string
        aircraft = retrive_obj(1, aircraft_id, "")
    except:
        abort(404)
    return render_template('aircraft.html', aircraft=aircraft)
Exemple #2
0
def find_aircraft():
    form = SearchForm()
    if request.method == 'POST' and form.validate():
        # Add new aircraft to DB
        operator = form.operator.data
        # Mode 1 to read one instance, mode 2 to read all instances, mode 3 to search by operator contains string
        aircrafts = retrive_obj(3, 0, operator)
        return render_template('aircrafts.html', aircrafts=aircrafts)
    return render_template('aircraft_search_form.html', form=form)
Exemple #3
0
def update_aircraft(aircraft_id):
    form = UpdateForm()
    if request.method == 'POST' and form.validate():
        # Add new aircraft to DB
        operator = form.operator.data
        model = form.model.data
        registration = form.registration.data
        cn_fl = form.cn_fl.data
        update_obj(aircraft_id, operator, model, registration, cn_fl)
        aircrafts = retrive_obj(2, 0, "")
        return redirect('/aircrafts')
    return render_template('aircraft_update_form.html', form=form)
Exemple #4
0
def new_aircraft():
    form = AircraftForm()
    if request.method == 'POST' and form.validate():
        # Add new aircraft to DB
        operator = form.operator.data
        model = form.model.data
        registration = form.registration.data
        cn_fl = form.cn_fl.data
        create_obj(operator, model, registration, cn_fl)
        # Mode 1 to read one instance, mode 2 to read all instances, mode 3 to search by operator contains string
        aircrafts = retrive_obj(2, 0, "")
        return redirect('/aircrafts')
    return render_template('aircraft_new_form.html', form=form)
Exemple #5
0
def index():
    # Mode 1 to read one instance, mode 2 to read all instances, mode 3 to search by operator contains string
    aircrafts = retrive_obj(2, 0, "")
    return render_template('aircrafts.html', aircrafts=aircrafts)