예제 #1
0
 def add_topic_view_counts(self, posts):
     """
     Adds view counts for the Topics of the given Posts.
     """
     for post, view_count in izip(
             posts, redis.get_view_counts([p.topic_id for p in posts])):
         post.topic_view_count = view_count
     return posts
예제 #2
0
파일: models.py 프로젝트: Anyson/forum
 def add_topic_view_counts(self, posts):
     """
     Adds view counts for the Topics of the given Posts.
     """
     for post, view_count in izip(posts,
                                  redis.get_view_counts([p.topic_id for p in posts])):
         post.topic_view_count = view_count
     return posts
예제 #3
0
 def add_view_counts(self, topics):
     """
     Adds view counts to the given Topics.
     """
     for topic, view_count in izip(
             topics, redis.get_view_counts([t.pk for t in topics])):
         topic.view_count = view_count
     return topics
예제 #4
0
파일: models.py 프로젝트: Anyson/forum
 def add_view_counts(self, topics):
     """
     Adds view counts to the given Topics.
     """
     for topic, view_count in izip(topics,
                                   redis.get_view_counts([t.pk for t in topics])):
         topic.view_count = view_count
     return topics