def delete_entry(): u = User(request.form['name'], request.form['email']) db_session.query(User).filter(User.name==u.name).delete() db_session.commit() flash('Selected User was successfully deleted') return redirect(url_for('show_entries'))
def show_entries(): users_query = db_session.query(User) entries = [dict(name=user.name, email=user.email, description=user.description) for user in users_query] print len(entries) return json.dumps(entries)
def update_entry(): u = db_session.query(User).filter(User.name==request.form['name']).first() u.description = 'my description' db_session.commit() print '##########' print u.description return redirect(url_for('show_entries'))