def edit_director(director_id): edited_director = db_helper.get_director(director_id) if request.method == 'POST': i_amcreator = check_creator(edited_director.user_id) if i_amcreator is not True: return redirect(url_for('list_all_directors')) edited_director = db_helper.edit_director(request, director_id) flash("Director Edited Successfully!") return redirect(url_for('list_director', director_id=director_id)) else: return render_template('editDirector.html', director=edited_director)
def list_movie(director_id, movie_id): director = db_helper.get_director(director_id) movie = db_helper.get_movie(movie_id) if 'user_id' not in login_session: user = None else: user = "******" i_amcreator = check_creator(movie.user_id) if i_amcreator is not True: return redirect(url_for('list_all_directors')) return render_template('listMovie.html', movie=movie, director=director, user=user)
def delete_director(director_id): director_to_delete = db_helper.get_director(director_id) i_amcreator = check_creator(director_to_delete.user_id) if i_amcreator is not True: return redirect(url_for('list_all_directors')) if request.method == 'POST': db_helper.delete_movies_by_director(director_id) director_to_delete = db_helper.delete_director(director_id) flash("Director Delete Successfully!") return redirect(url_for('list_all_directors')) else: return render_template('deleteDirector.html', director=director_to_delete)
def list_director(director_id): director = db_helper.get_director(director_id) movies = db_helper.get_movies_by_director(director_id) if not movies: flash("No movie on the list. Let's add one") if 'user_id' not in login_session: user = None else: user = "******" i_amcreator = check_creator(director.user_id) if i_amcreator is not True: return redirect(url_for('list_all_directors')) return render_template('listDirector.html', director=director, movies=movies, user=user)