# coding: utf-8

from flask import Blueprint
from flask import render_template
from ..models import Node, Topic, fill_topics


bp = Blueprint('front', __name__)


@bp.route('/')
def home():
    topics = Topic.query.order_by(Topic.id.desc()).limit(16)
    topics = fill_topics(topics)

    nodes = Node.query.order_by(Node.id.desc()).limit(10)
    return render_template('index.html', topics=topics, nodes=nodes)

@@ -72,16 +72,51 @@
 emplate%0A
+from ..helpers import require_user%0A
 from ..m
@@ -218,16 +218,52 @@
 home():%0A
+    %22%22%22The homepage of the site.%22%22%22%0A
     topi
@@ -348,17 +348,16 @@
 topics)%0A
-%0A
     node
@@ -475,8 +475,134 @@
 =nodes)%0A
+%0A%0A@bp.route('/upload', methods=%5B'POST'%5D)%0A@require_user%0Adef upload():%0A    %22%22%22Upload images handler.%22%22%22%0A    #TODO%0A    return ''%0A

prepare for upload handler