comparison gpp/forums/models.py @ 386:9fcd366f22dc

Revert r323. Send out forum topic subscription emails as people post. Don't limit them.
author Brian Neal <bgneal@gmail.com>
date Thu, 17 Mar 2011 01:20:23 +0000
parents ee451ad46af1
children b15726767ab8
comparison
equal deleted inserted replaced
385:2a03c69792d8 386:9fcd366f22dc
181 user = models.ForeignKey(User) 181 user = models.ForeignKey(User)
182 view_count = models.IntegerField(blank=True, default=0) 182 view_count = models.IntegerField(blank=True, default=0)
183 sticky = models.BooleanField(blank=True, default=False) 183 sticky = models.BooleanField(blank=True, default=False)
184 locked = models.BooleanField(blank=True, default=False) 184 locked = models.BooleanField(blank=True, default=False)
185 subscribers = models.ManyToManyField(User, related_name='subscriptions', 185 subscribers = models.ManyToManyField(User, related_name='subscriptions',
186 verbose_name='subscribers', blank=True, through='Subscription') 186 verbose_name='subscribers', blank=True)
187 bookmarkers = models.ManyToManyField(User, related_name='favorite_topics', 187 bookmarkers = models.ManyToManyField(User, related_name='favorite_topics',
188 verbose_name='bookmarkers', blank=True) 188 verbose_name='bookmarkers', blank=True)
189 189
190 # denormalized fields to reduce database hits 190 # denormalized fields to reduce database hits
191 post_count = models.IntegerField(blank=True, default=0) 191 post_count = models.IntegerField(blank=True, default=0)
390 ordering = ('order', ) 390 ordering = ('order', )
391 391
392 def __unicode__(self): 392 def __unicode__(self):
393 return u'Post %d, %s' % (self.post.pk, self.embed.title) 393 return u'Post %d, %s' % (self.post.pk, self.embed.title)
394 394
395
396 class Subscription(models.Model):
397 """
398 This model is a "through" table for the M2M relationshiop between forum
399 topics and users (subscribers).
400 """
401 topic = models.ForeignKey(Topic)
402 user = models.ForeignKey(User)
403 notify_date = models.DateTimeField(null=True)