start the new topics route and view
This commit is contained in:
17
app/routes/topics.py
Normal file
17
app/routes/topics.py
Normal file
@@ -0,0 +1,17 @@
|
||||
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'
|
||||
Reference in New Issue
Block a user