Mercurial > public > sg101
diff gpp/bio/models.py @ 329:000c006fee97
Various small changes to reduce database hits.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 23 Feb 2011 03:40:18 +0000 |
parents | 4d086d2210b9 |
children | 9d470c7a2b93 |
line wrap: on
line diff
--- a/gpp/bio/models.py Tue Feb 22 05:40:29 2011 +0000 +++ b/gpp/bio/models.py Wed Feb 23 03:40:18 2011 +0000 @@ -112,19 +112,7 @@ return ('bio-view_profile', (), {'username': self.user.username}) def badge_ownership(self): - if hasattr(self, '_badges'): - return self._badges - - cache_key = 'badges-%s' % self.user.username - self._badges = cache.get(cache_key) - if self._badges is not None: - return self._badges - - self._badges = BadgeOwnership.objects.filter(profile=self).select_related( - "badge") - - cache.set(cache_key, self._badges, 15 * 60) - return self._badges + return BadgeOwnership.objects.filter(profile=self).select_related('badge') def is_stranger(self): """Returns True if this user profile status is STA_STRANGER."""