Beispiel #1
0
def songs_index():
    # Only show songs which are public or made by the current user, show your songs first
    songs = Song.query.filter((Song.public == True)
                              | (Song.account_id == current_user.id)).order_by(
                                  Song.account_id != current_user.id).all()
    no_songs = User.find_accounts_with_no_public_songs()
    return render_template("songs/list.html",
                           songs=songs,
                           no_songs=no_songs,
                           current_user_id=current_user.id)