예제 #1
0
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'))
예제 #2
0
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)
예제 #3
0
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'))