##// END OF EJS Templates
Updates to the user model
neko259 -
r624:e21a263d default
parent child Browse files
Show More
@@ -56,8 +56,8 b' class User(models.Model):'
56 56 tags = self.fav_tags.annotate(Count('threads')) \
57 57 .filter(threads__count__gt=0).order_by('name')
58 58
59 if tags.exists():
60 cache.set(cache_key, tags, settings.CACHE_TIMEOUT)
59 if tags:
60 cache.set(cache_key, tags)
61 61
62 62 return tags
63 63
@@ -68,8 +68,12 b' class User(models.Model):'
68 68 return self.user_id + '(' + str(self.rank) + ')'
69 69
70 70 def get_last_access_time(self):
71 """
72 Gets user's last post time.
73 """
74
71 75 posts = Post.objects.filter(user=self)
72 if posts.count() > 0:
76 if posts.exists() > 0:
73 77 return posts.latest('pub_time').pub_time
74 78
75 79 def add_tag(self, tag):
General Comments 0
You need to be logged in to leave comments. Login now