Commit 258a9851089335d17e54c99520d308dc16973ebf

  • avatar
  • xarch
  • Wed May 11 14:24:32 CEST 2011
Correction d'un problème de lu/non-lu
  
3434
3535 def first_post(self):
3636 return Post.objects.filter(topic=self)[0]
37
3738 def last_read_post(self):
3839 read = TopicRead.objects.select_related(
3940 ).filter(topic=self, user=get_current_user()
40 )
41 ).order_by('-post__creation')
4142 if len(read) == 0:
4243 return self.first_post()
4344 else:
100100 return Post.objects.filter(topic=id).order_by('creation')[0]
101101
102102def mark_read(topic):
103 TopicRead.objects.filter(topic=topic,user=get_current_user()).delete()
103 TopicRead.objects.filter(topic=topic,user=get_current_user()).delete()
104104 t = TopicRead(post=topic.last_post, topic=topic, user=get_current_user())
105105 t.save()
106106