18 lines
409 B
Python
18 lines
409 B
Python
from flask import Blueprint, redirect, url_for, render_template
|
|
|
|
from ..models import Topics
|
|
|
|
bp = Blueprint('topics', __name__, url_prefix = '/topics/')
|
|
|
|
@bp.get('/')
|
|
def all_topics():
|
|
topic_list = Topics.get_list()
|
|
return render_template('topics/topics.html', topics=topic_list)
|
|
|
|
@bp.get('/<slug>')
|
|
def topic(slug):
|
|
t = Topics.find({'slug': slug})
|
|
if t:
|
|
return 'yes'
|
|
return 'no'
|