You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
783 B
Python
33 lines
783 B
Python
from flask import (Blueprint, flash, g, redirect,
|
|
request, session, url_for, jsonify)
|
|
from flask_mako import render_template
|
|
|
|
from exquisite_branch.db import get_db
|
|
|
|
|
|
bp = Blueprint('display', __name__, url_prefix='/display')
|
|
|
|
|
|
@bp.route('/')
|
|
def list():
|
|
db = get_db()
|
|
trees = db.execute('SELECT * FROM trees').fetchall()
|
|
return render_template('list.html', trees=trees)
|
|
|
|
|
|
@bp.route('/<tree>/')
|
|
def display(tree=None):
|
|
db = get_db()
|
|
|
|
branches = db.execute(
|
|
"SELECT content, id, parent, username FROM branches WHERE tree = ?",
|
|
(tree,)
|
|
).fetchall()
|
|
|
|
return render_template('display.html', tree=tree, branches=branches)
|
|
|
|
|
|
@bp.route('/<tree>/js/')
|
|
def js(tree=None):
|
|
return render_template('display_js.html', tree=tree)
|