diff options
author | Aurélien Bompard <aurelien@bompard.org> | 2012-09-12 09:31:21 +0200 |
---|---|---|
committer | Aurélien Bompard <aurelien@bompard.org> | 2012-09-12 09:31:21 +0200 |
commit | bf62d083d818f074522f7fb095f93987afbb5bdc (patch) | |
tree | 87a26e868eec95f6d1a65a224f159731143a7b45 /hyperkitty/models.py | |
parent | 643a4a97ff7cd5013e25d2eeb6bcc68cf524c1d7 (diff) | |
download | hyperkitty-bf62d083d818f074522f7fb095f93987afbb5bdc.tar.gz hyperkitty-bf62d083d818f074522f7fb095f93987afbb5bdc.tar.xz hyperkitty-bf62d083d818f074522f7fb095f93987afbb5bdc.zip |
Improve the user voting display (only one SQL query)
Diffstat (limited to 'hyperkitty/models.py')
-rw-r--r-- | hyperkitty/models.py | 20 |
1 files changed, 0 insertions, 20 deletions
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)) |