fixed problem with topic update time
This commit is contained in:
parent
88ad31ae18
commit
797f8c7b96
2 changed files with 2 additions and 1 deletions
|
@ -114,7 +114,7 @@ class Topic(models.Model):
|
|||
forum = models.ForeignKey(Forum, related_name='topics', verbose_name=_('Forum'))
|
||||
name = models.CharField(_('Subject'), max_length=255)
|
||||
created = models.DateTimeField(_('Created'), auto_now_add=True)
|
||||
updated = models.DateTimeField(_('Updated'), auto_now=True)
|
||||
updated = models.DateTimeField(_('Updated'), null=True)
|
||||
user = models.ForeignKey(User, verbose_name=_('User'))
|
||||
views = models.IntegerField(_('Views count'), blank=True, default=0)
|
||||
sticky = models.BooleanField(_('Sticky'), blank=True, default=False)
|
||||
|
|
|
@ -14,6 +14,7 @@ def post_saved(instance, **kwargs):
|
|||
if created:
|
||||
topic.last_post = post
|
||||
topic.post_count = topic.posts.count()
|
||||
topic.updated = datetime.now()
|
||||
profile = post.user.forum_profile
|
||||
profile.post_count = post.user.posts.count()
|
||||
profile.save(force_update=True)
|
||||
|
|
Reference in a new issue