From bf62d083d818f074522f7fb095f93987afbb5bdc Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Wed, 12 Sep 2012 09:31:21 +0200 Subject: Improve the user voting display (only one SQL query) --- hyperkitty/models.py | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'hyperkitty/models.py') diff --git a/hyperkitty/models.py b/hyperkitty/models.py index 6a8bd63..c84ef51 100644 --- a/hyperkitty/models.py +++ b/hyperkitty/models.py @@ -53,26 +53,6 @@ class UserProfile(models.Model): karma = models.IntegerField(default=1) - def _get_votes(self): - "Returns all the votes by a user" - # Extract all the votes by this user - try: - votes = Rating.objects.filter(user=self.user) - except Rating.DoesNotExist: - votes = {} - - # TODO: warning, not thread-safe, should get the cached connection from - # the WSGI environment - store = get_store(settings.KITTYSTORE_URL) - for vote in votes: - list_name = vote.list_address.split('@')[0] - message = store.get_message_by_id_from_list(vote.list_address, vote.messageid) - vote.message = message - - return votes - - votes = property(_get_votes) - def __unicode__(self): """Unicode representation""" return u'%s' % (unicode(self.user)) -- cgit