Skip to content

Instantly share code, notes, and snippets.

@rayhaanj
Last active January 4, 2016 22:19
Show Gist options
  • Save rayhaanj/8687167 to your computer and use it in GitHub Desktop.
Save rayhaanj/8687167 to your computer and use it in GitHub Desktop.
flask view function
@app.route('/add', methods=['POST'])
def add_entry():
if not session.get('logged_in'):
abort(401)
database_session.add( Item( "some data here" ) )
database_session.commit()
flash('New entry was successfully posted')
return redirect(url_for('show_entries'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment