fufuninja / django-voting

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

GenericForeignKey location has moved #4

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
According to 
http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#Genericrelations
havemoved

GenericForeignKey has been moved to into the django.contrib.contenttypes
module ...

Which means that this patch is need for the latest trunk version (May 2007):

===================================================================
--- voting/models.py    (revision 41)
+++ voting/models.py    (working copy)
@@ -1,4 +1,5 @@
 from django.db import backend, connection, models
+from django.contrib.contenttypes import generic
 from django.contrib.contenttypes.models import ContentType
 from django.contrib.auth.models import User

@@ -138,7 +139,7 @@
     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()

Beste regards

           Alex

Original issue reported on code.google.com by Alexande...@gmail.com on 16 May 2007 at 9:22

GoogleCodeExporter commented 8 years ago
Fixed in revision 45, including backwards compatibility.

Original comment by jonathan.buchanan on 16 May 2007 at 6:57