cleverking / django-voting

Automatically exported from code.google.com/p/django-voting
Other
0 stars 0 forks source link

typo in get_top #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi jonathan!

the query in get_top is missing a whitespace:

sql     
'\nSELECT object_id, SUM(vote)\nFROM "votes"\nWHERE content_type_id =
%s\nGROUP BY object_idHAVING

it would be very nice if you add a get_top_for_objects function. so that it
would be possible to show "fresh" and "hot" tags.

bye

Original issue reported on code.google.com by jefferso...@googlemail.com on 20 Mar 2007 at 10:16

GoogleCodeExporter commented 9 years ago

Original comment by jonathan.buchanan on 21 Mar 2007 at 4:27

GoogleCodeExporter commented 9 years ago
i dont know where to put this else..

not a big but useful addition:

    def get_users(self, obj, limit=None):
        """
        Get all or a limited number of votes on the given object.
        """
        ctype = ContentType.objects.get_for_model(obj)
        vote = self.filter(content_type=ctype, object_id=obj.id)[:limit]
        return vote

showing the users and their votes for an object is useful to get a better 
picture of
the result of the vote. 

for example, if i see a django-dev voted a snippet up on djangosnippets, i know 
i can
really trust it. 

bye

Original comment by jefferso...@googlemail.com on 22 Mar 2007 at 8:39

GoogleCodeExporter commented 9 years ago
Fixed the typo in revision 46.

Original comment by jonathan.buchanan on 16 May 2007 at 10:23