Beispiel #1
0
def reviews_sorted(sortby):
    reviews = Rating.reviews()
    desc = False
    if ('film' in sortby):
        reviews = sorted(reviews, key=lambda rating: rating[0])

    if ('score' in sortby):
        reviews = sorted(reviews, key=lambda rating: rating[4], reverse=True)
    if ('user' in sortby):
        reviews = sorted(reviews, key=lambda rating: rating[2])
    if ('review' in sortby):
        reviews = sorted(reviews, key=lambda rating: rating[5])
    if ('desc' in sortby):
        reviews.reverse()
        desc = True
    return render_template("ratings/reviewlist.html",
                           reviews=reviews,
                           sortby=sortby,
                           desc=desc)
Beispiel #2
0
def reviews_index():
    reviews = Rating.reviews()
    return render_template("ratings/reviewlist.html",
                           reviews=reviews,
                           sortby=None,
                           desc=None)