def show_movies_json(category_id): """ JSON API endpoint for movies of a specified movie category :param category_id: The ID of the movie category :return: JSON information about movies for specified category """ movies = get_movies_by_category(category_id) return jsonify(movies=[m.serialize for m in movies])
def show_movies(category_id): """ Show the movies for a specified movie category :param category_id: The ID of the movie category :return: Web page displaying movies for specified category """ movie_categories = get_movie_categories() movie_category = get_movie_category_by_id(category_id) movies = get_movies_by_category(category_id) print session.get(SESSION_USERNAME) if SESSION_USERNAME not in session: return render_template("movies_public.html", title="Movies", movie_category=movie_category, movies=movies, movie_categories=movie_categories) else: return render_template("movies.html", title="Movies", movie_category=movie_category, movies=movies, movie_categories=movie_categories)