Mercurial > public > sg101
comparison gpp/forums/models.py @ 445:e9f203c5f5bb
Attempting to fix #218; update the topic last visit time with 'now' when viewing the last page of a topic, otherwise use the creation time of the last post on the page.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 08 Jun 2011 00:24:41 +0000 |
parents | c8148cf11a79 |
children | 9d3bd7304050 |
comparison
equal
deleted
inserted
replaced
444:a0847158cf72 | 445:e9f203c5f5bb |
---|---|
391 def __unicode__(self): | 391 def __unicode__(self): |
392 return u'Topic: %d User: %d Date: %s' % (self.topic.id, self.user.id, | 392 return u'Topic: %d User: %d Date: %s' % (self.topic.id, self.user.id, |
393 self.last_visit.strftime('%Y-%m-%d %H:%M:%S')) | 393 self.last_visit.strftime('%Y-%m-%d %H:%M:%S')) |
394 | 394 |
395 def save(self, *args, **kwargs): | 395 def save(self, *args, **kwargs): |
396 if self.id is None: | 396 if self.last_visit is None: |
397 self.touch() | 397 self.touch() |
398 super(TopicLastVisit, self).save(*args, **kwargs) | 398 super(TopicLastVisit, self).save(*args, **kwargs) |
399 | 399 |
400 def touch(self): | 400 def touch(self): |
401 self.last_visit = datetime.datetime.now() | 401 self.last_visit = datetime.datetime.now() |