def rate_movie(film_id, val): film = Film() user = User() if not film.check_film(film_id): return render_template("404.html") if not user.check_rate(film_id): user.rate(film_id, val) film.rate(film_id, val) return redirect(url_for('movie', film_id=film_id))
def delete_rate(film_id): film = Film() user = User() if not film.check_film(film_id): return render_template("404.html") if user.check_rate(film_id): val = user.delete_rate(film_id) film.delete_rate(film_id, val) return redirect(url_for('movie', film_id=film_id))
def favorite(film_id): db_f = Film() if not db_f.check_film(film_id): return render_template('404.html') db = Favorites() user_id = db.current_user(session['__auth']) if not db.check_duplicate(user_id, film_id): db.add_favorites(user_id, film_id) return redirect(url_for('movie', film_id=film_id))
def movie(film_id): form = ReviewForm() db = Film() db_w = Watchlist() db_user = User() page = request.args.get('page', '1') if not db.check_film(film_id): return render_template('404.html') (film, directors, actors, genres, reviews, page, pageCount) = db.get_film(film_id, page) if session.get("__auth"): list_names = db_w.watchlist_names(session["__auth"]) rate = db_user.check_rate(film_id) else: list_names = [] rate = 0 return render_template('movie.html', form=form, film=film, directors=directors, actors=actors, genres=genres, reviews=reviews, list_names=list_names, rate=rate, page=page, pageCount=pageCount)