コード例 #1
0
 def related_publications(request, publication_id):
     """Returns publications that are related to the current publication."""
     publication = Publication.objects.get(id=publication_id)
     publications = search.get_related_publications(publication)
     values = {'publications': publications}
     response = RestView.render_response(request, 'publications', values)
     return response
コード例 #2
0
 def test_get_recommended_publications(self):
     publications = get_related_publications(self.pub1)
     self.assertListEqual([self.pub2], list(publications))