def search_movies(): """ Search all the movies in your media server """ # Check if the user is logged in, if not: back to login. if('logged_in' not in session or not session['logged_in']): return redirect(url_for('login')) ######### # TODO # ######### global allmovies global alltvshows ############################################################################# # Fill in the Function below with to do all data handling for searching for # # a movie # ############################################################################# page['title'] = 'Movie Search' # Add the title movies = None if request.method == 'POST': # Set up some variables to manage the post returns movies = database.find_matchingmovies(request.form['searchterm']) # Once retrieved, do some data integrity checks on the data if movies == None or movies == []: movies = [] page['bar'] = False flash("No matching movies found, please try again") else: page['bar'] = True flash('Found '+str(len(movies))+' results!') session['logged_in'] = True # Once verified, send the appropriate data to # NOTE :: YOU WILL NEED TO MODIFY THIS TO PASS THE APPROPRIATE VARIABLES or Go elsewhere return render_template('searchitems/search_movies.html', session=session, page=page, user=user_details, movies = movies, allmovies = allmovies, alltvshows = alltvshows) else: # NOTE :: YOU WILL NEED TO MODIFY THIS TO PASS THE APPROPRIATE VARIABLES return render_template('searchitems/search_movies.html', session=session, page=page, user=user_details, movies = movies, allmovies = allmovies, alltvshows = alltvshows)
def search_movies(): """ Search all the movies in your media server """ # Check if the user is logged in, if not: back to login. if ('logged_in' not in session or not session['logged_in']): return redirect(url_for('login')) movies = None ######### # TODO # ######### ############################################################################# # Fill in the Function below with to do all data handling for searching for # # a movie # ############################################################################# page['title'] = 'Movie Search' # Add the title if request.method == 'POST': movies = database.find_matchingmovies(request.form['searchterm']) # Data integrity checks if movies == None or movies == []: movies = [] page['bar'] = False flash("No matching movies found, please try again") else: page['bar'] = True flash('Found ' + str(len(movies)) + ' results!') session['logged_in'] = True return render_template('searchitems/search_movies.html', session=session, page=page, user=user_details, movies=movies)
def search_movies(): """ Search all the movies in your media server """ # Check if the user is logged in, if not: back to login. if('logged_in' not in session or not session['logged_in']): return redirect(url_for('login')) ######### # TODO # ######### page['title'] = 'Match Movies' movies = None if(request.method == 'POST'): movies = database.find_matchingmovies(request.form['searchterm']) # Once verified, send the appropriate data to if movies == None or movies == []: movies = [] page['bar'] = False flash("No matching movies found, please try again") else: page['bar'] = True flash('Found '+str(len(movies))+' results!') session['logged_in'] = True # NOTE :: YOU WILL NEED TO MODIFY THIS TO PASS THE APPROPRIATE VARIABLES or Go elsewhere return render_template('searchitems/search_movies.html', session=session, page=page, user=user_details, movies=movies)