예제 #1
0
파일: tests.py 프로젝트: georgebrock/Versus
 def test_recommendations(self):
     p = UserProfile.objects.in_bulk([1,2,3,4])
     self.assertEqual(
         [],
         [v.pk for score,v in recommended_venues(p[1])],
     )
     self.assertEqual(
         [2],
         [v.pk for score,v in recommended_venues(p[2])],
     )
     self.assertEqual(
         [],
         [v.pk for score,v in recommended_venues(p[3])],
     )
     self.assertEqual(
         set([2, 3]),
         set([v.pk for score,v in recommended_venues(p[4])]),
     )
예제 #2
0
파일: views.py 프로젝트: georgebrock/Versus
    def get_context_data(self):
        venue_a, venue_b = self.request.user.get_profile().venue_pair()

        #TODO Move this out of the request cycle!
        recommendations = recommended_venues(self.request.user.get_profile())

        return {
            'venue_a': venue_a,
            'venue_b': venue_b,
            'recommendations': recommendations,
        }