Rating system
Each user (when logged in) can rate movies simply by clicking on the rate value (1 to 5) at the side of the movie title in the movies' results page (see preceding screenshot). This action will trigger the rate_movie
function in the views.py
file (through the corresponding URL in urls.py
):
def rate_movie(request): data = request.GET rate = data.get("vote") movies,moviesindxs = zip(*literal_eval(data.get("movies"))) movie = data.get("movie") movieindx = int(data.get("movieindx")) #save movie rate userprofile = None if request.user.is_superuser: return render_to_response( 'books_recsys_app/superusersignin.html', RequestContext(request)) elif request.user.is_authenticated() : userprofile = UserProfile.objects.get(user=request.user) else: return render_to_response( 'books_recsys_app/pleasesignin.html', RequestContext(request)) if MovieRated.objects.filter(movie=movie).filter(user=userprofile...