Esempio n. 1
0
def index():
    """Shows all the twisks from the logged-in user feed"""
    twisks = []
    if request.method == "POST":
        twisk = Twisk(
            author=current_user.key,
            content=request.form['content']
        )
        twisk.put()

        # Append the twisk to the feed because the DB probably won't have
        # finished to apply the changes by the time this function has finished
        # executing
        twisks.append(twisk)

        flash("Twisk successfully posted !")

    twisks.extend(current_user.get_feed())
    return render_template("index.html", twisks=twisks, trending_tags=Tag.get_trending())