def actualizar(): if request.method == "POST": qry = Alumnos.query.get(request.form['id']) qry.nombre = request.form['nombreE'] qry.apellido = request.form['apellidoE'] db.session.commit() return redirect(url_for('listar'))
def add_entry(): if not session.get('logged_in'): abort(401) entry = Entry(title=request.form['title'], text=request.form['text']) db.session.add(entry) db.session.commit() flash('New entry was successfully posted') return redirect(url_for('show_entries'))
def add_entry(): if not session.get('logged_in'): abort(401) db = get_db() db.execute('insert into entries (title, text) values (?, ?)', [request.form['title'], request.form['text']]) db.commit() flash('New entry was successfully posted') return redirect(url_for('show_entries'))
def login(): error = None if request.method == 'POST': if request.form['username'] != app.config['USERNAME']: error = 'Invalid username' elif request.form['password'] != app.config['PASSWORD']: error = 'Invalid password' else: session['logged_in'] = True flash('You were logged in') return redirect(url_for('show_entries')) return render_template('login.html', error=error)
def logout(): session.pop('logged_in', None) flash('You were logged out') return redirect(url_for('show_entries'))
def eliminar(id): Alumnos.query.filter(Alumnos.id == id).delete() db.session.commit() return redirect(url_for('listar'))