Exemplo n.º 1
0
 def read(self, request, id):
     user = self.get_user(request, id)
     ratings = rating_helper.get_user_ratings(user.id)
     return paginated_collection(request, [
             {
                 'film_uri': reverse(films_handler, args=[self.film_id_to_imdb_code(i)]),
                 'value': rating
             } for (i, rating) in ratings.items()
     ], default_limit=50)
Exemplo n.º 2
0
 def read(self, request, id):
     from film20.new_recommendations.similarity_engine import reclist_from_similarities
     user = self.get_user(request, id)
     ratings = rating_helper.get_user_ratings(user.id)
     film_ids = self.to_recommend_ids(request)
     reclist = [
             {
                 'film_uri': reverse(films_handler, args=[self.film_id_to_imdb_code(id)])
             } for id in reclist_from_similarities(ratings, film_ids) if id not in ratings.keys()
     ]
     return paginated_collection(request, reclist, default_limit=50)