comparison gpp/forums/models.py @ 407:42a4e66972d5

Trying to fix #200; found a bug in the get_forum_unread_status() function. Added some db indexes.
author Brian Neal <bgneal@gmail.com>
date Fri, 01 Apr 2011 01:18:44 +0000
parents 9af6bd45c1f8
children b1f939b1fb01
comparison
equal deleted inserted replaced
406:f469261d617b 407:42a4e66972d5
188 """ 188 """
189 A topic is a thread of discussion, consisting of a series of posts. 189 A topic is a thread of discussion, consisting of a series of posts.
190 """ 190 """
191 forum = models.ForeignKey(Forum, related_name='topics') 191 forum = models.ForeignKey(Forum, related_name='topics')
192 name = models.CharField(max_length=255) 192 name = models.CharField(max_length=255)
193 creation_date = models.DateTimeField(auto_now_add=True) 193 creation_date = models.DateTimeField(db_index=True)
194 user = models.ForeignKey(User) 194 user = models.ForeignKey(User)
195 view_count = models.IntegerField(blank=True, default=0) 195 view_count = models.IntegerField(blank=True, default=0)
196 sticky = models.BooleanField(blank=True, default=False) 196 sticky = models.BooleanField(blank=True, default=False)
197 locked = models.BooleanField(blank=True, default=False) 197 locked = models.BooleanField(blank=True, default=False)
198 subscribers = models.ManyToManyField(User, related_name='subscriptions', 198 subscribers = models.ManyToManyField(User, related_name='subscriptions',
369 Objects of this class exist for the window specified in the 369 Objects of this class exist for the window specified in the
370 corresponding ForumLastVisit object. 370 corresponding ForumLastVisit object.
371 """ 371 """
372 user = models.ForeignKey(User) 372 user = models.ForeignKey(User)
373 topic = models.ForeignKey(Topic) 373 topic = models.ForeignKey(Topic)
374 last_visit = models.DateTimeField() 374 last_visit = models.DateTimeField(db_index=True)
375 375
376 class Meta: 376 class Meta:
377 unique_together = ('user', 'topic') 377 unique_together = ('user', 'topic')
378 ordering = ('-last_visit', ) 378 ordering = ('-last_visit', )
379 379