def show_devices(): results = [] qry = db_session.query(Device) results = qry.all() table = Results(results) table.border = True return render_template('results.html', table=table, form='new_device', item='device')
def show_hosts(): results = [] qry = db_session.query(Host) results = qry.all() table = Water(results) table.border = True return render_template('results.html', table=table, form='new_host', item='host')
def searchResults(search): results = [] search_string = search.data['search'] if search.data['search'] == '': qry = db_session.query(CardInformation) results = qry.all() if not results: flash('No results found!') return redirect('/') else: # display results return render_template('results.html', table=results)
def edit(id): qry = db_session.query(Device).filter(Device.id == id) device = qry.first() if device: form = DeviceForm(formdata=request.form, obj=device) if request.method == 'POST' and form.validate(): # save edits save_changes(device, form) flash('device updated successfully!') return redirect('/') return render_template('edit_device.html', form=form) else: return 'Error loading #{id}'.format(id=id)
def change(id): qry = db_session.query(Host).filter(Host.id == id) host = qry.first() if host: form = HostForm(formdata=request.form, obj=host) if request.method == 'POST' and form.validate(): # save edits save_host(host, form) flash('host updated successfully!') return redirect('/') return render_template('edit_host.html', form=form) else: return 'Error loading #{id}'.format(id=id)
def editTemplates(id): qry = db_session.query(CardInformation).filter( CardInformation.id == id) album = qry.first() if album: form = CardSearchForm(formdata=request.form, obj=album) if request.method == 'POST' and form.validate(): # save edits saveChanges(album, form) flash('Album updated successfully!') return redirect('/') return render_template('edit_album.html', form=form) else: return 'Error loading #{id}'.format(id=id)