Permalink
Browse files

Updated to handle move of generic relations in Django revision 5172

git-svn-id: https://django-voting.googlecode.com/svn/trunk@45 662f01ad-f42a-0410-a340-718c64ddaef4
  • Loading branch information...
insin committed May 16, 2007
1 parent a6a14fd commit 29b56c5ae5fbff3af8a34a61e9a54f9163a6bf09
Showing with 7 additions and 1 deletion.
  1. +7 −1 models.py
View
@@ -2,6 +2,12 @@
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
+# Generic relations were moved in Django revision 5172
+try:
+ from django.contrib.contenttypes import generic
+except ImportError:
+ import django.db.models as generic
+
class VoteManager(models.Manager):
def get_score(self, obj):
"""
@@ -138,7 +144,7 @@ class Vote(models.Model):
user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
- object = models.GenericForeignKey('content_type', 'object_id')
+ object = generic.GenericForeignKey('content_type', 'object_id')
vote = models.SmallIntegerField(choices=SCORES)
objects = VoteManager()

0 comments on commit 29b56c5

Please sign in to comment.