Skip to content

Commit

Permalink
Replaced some recently introduced usage of .id with ._get_pk_val()
Browse files Browse the repository at this point in the history
git-svn-id: https://django-voting.googlecode.com/svn/trunk@69 662f01ad-f42a-0410-a340-718c64ddaef4
  • Loading branch information
insin committed Nov 6, 2008
1 parent cc0337f commit a899a7b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions voting/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand All @@ -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 {}

Expand Down

0 comments on commit a899a7b

Please sign in to comment.