Permalink
Browse files

Replaced some recently introduced usage of .id with ._get_pk_val()

git-svn-id: https://django-voting.googlecode.com/svn/trunk@69 662f01ad-f42a-0410-a340-718c64ddaef4
  • Loading branch information...
1 parent cc0337f commit a899a7b03e9e1528834be6ac061a7d601d5e54d7 @insin insin committed Nov 6, 2008
Showing with 3 additions and 2 deletions.
  1. +3 −2 voting/managers.py
View
5 voting/managers.py
@@ -9,7 +9,8 @@ def get_score(self, obj):
the number of votes it's received.
"""
ctype = ContentType.objects.get_for_model(obj)
- result = self.filter(object_id=obj.id, content_type=ctype).extra(
+ result = self.filter(object_id=obj._get_pk_val(),
+ content_type=ctype).extra(
select={
'score': 'COALESCE(SUM(vote), 0)',
'num_votes': 'COALESCE(COUNT(vote), 0)',
@@ -25,7 +26,7 @@ def get_scores_in_bulk(self, objects):
Get a dictionary mapping object ids to total score and number
of votes for each object.
"""
- object_ids = [o.id for o in objects]
+ object_ids = [o._get_pk_val() for o in objects]
if not object_ids:
return {}

0 comments on commit a899a7b

Please sign in to comment.