Exemple #1
0
def add_filmInList(list_name, film_id):
    db = Watchlist()
    username = session['__auth']
    if not db.check_watchlist(username, list_name):
        return render_template('404.html')
    list_id = db.get_list_id(username, session['__auth'], list_name)
    db.add_film(list_id, film_id)
    return redirect(url_for('movie', film_id=film_id))
Exemple #2
0
def new_filmInlist(film_id):
    username = session["__auth"]
    form = WatchlistForm(username)
    db = Watchlist()
    if form.validate_on_submit():
        list_name = form.title.data
        body = form.content.data
        if request.form.get("mycheckbox"):
            db.add_watchlist(username, list_name, body)
            list_id = db.get_list_id(username, session['__auth'], list_name)
            db.add_film(list_id, film_id)
        else:
            db.add_watchlist(username, list_name, body)
        return redirect(url_for("movie", film_id=film_id))
    return render_template('newlist.html', form=form,
                           title="New Flow", checkbox=True)