Skip to content

Commit

Permalink
Make compatible with later versions of django
Browse files Browse the repository at this point in the history
  • Loading branch information
kbairak committed Feb 24, 2017
1 parent 091dc53 commit aa18815
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tagging/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
from sets import Set as set

import urllib
from django.contrib.contenttypes import generic
try:
# django 1.5-ish
from django.contrib.contenttypes.generic import GenericForeignKey
except ImportError:
# django 1.10-ish
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import connection, models
from django.db.models.query import QuerySet
Expand Down Expand Up @@ -482,7 +487,7 @@ class TaggedItem(models.Model):
tag = models.ForeignKey(Tag, verbose_name=_('tag'), related_name='items')
content_type = models.ForeignKey(ContentType, verbose_name=_('content type'))
object_id = models.PositiveIntegerField(_('object id'), db_index=True)
object = generic.GenericForeignKey('content_type', 'object_id')
object = GenericForeignKey('content_type', 'object_id')

objects = TaggedItemManager()

Expand Down

0 comments on commit aa18815

Please sign in to comment.