add name badges
This commit is contained in:
21
app.py
21
app.py
@@ -1,27 +1,12 @@
|
|||||||
import calendar_interface
|
import calendar_interface
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from flask import Flask, render_template, request, url_for, flash, redirect
|
from flask import Flask, render_template, g, request, url_for, flash, redirect
|
||||||
from werkzeug.exceptions import abort
|
from werkzeug.exceptions import abort
|
||||||
|
|
||||||
import db
|
import db
|
||||||
import auth
|
import auth
|
||||||
|
|
||||||
def get_db_connection():
|
|
||||||
conn = sqlite3.connect('database.db')
|
|
||||||
conn.row_factory = sqlite3.Row
|
|
||||||
return conn
|
|
||||||
|
|
||||||
def get_post(post_id):
|
|
||||||
conn = get_db_connection()
|
|
||||||
post = conn.execute('SELECT * FROM posts WHERE id = ?',
|
|
||||||
(post_id,)).fetchone()
|
|
||||||
conn.close()
|
|
||||||
if post is None:
|
|
||||||
abort(404)
|
|
||||||
return post
|
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.config['SECRET_KEY'] = '\xacI4\x077\x16?Q\xb4")\xdb\x066\x95\x11i\x0b\x0c&\xb6rP\''
|
app.config['SECRET_KEY'] = '\xacI4\x077\x16?Q\xb4")\xdb\x066\x95\x11i\x0b\x0c&\xb6rP\''
|
||||||
app.teardown_appcontext(db.close_db)
|
app.teardown_appcontext(db.close_db)
|
||||||
@@ -38,11 +23,9 @@ def index():
|
|||||||
if events is None:
|
if events is None:
|
||||||
abort(404)
|
abort(404)
|
||||||
else:
|
else:
|
||||||
return render_template('index.html', events=events)
|
return render_template('index.html', events=events, user=g.user)
|
||||||
|
|
||||||
# @app.route('/<int:event_id>')
|
# @app.route('/<int:event_id>')
|
||||||
# def post(post_id):
|
# def post(post_id):
|
||||||
# post = get_post(post_id)
|
# post = get_post(post_id)
|
||||||
# return render_template('show_event.html', post=post)
|
# return render_template('show_event.html', post=post)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user