Skip to content

Commit 1116a53

Browse files
author
kazmiruk
committed
add compatibility for django 1.6
1 parent b3e03cd commit 1116a53

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rest_framework/serializers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import inspect
1717
import types
1818
from decimal import Decimal
19-
from django.contrib.contenttypes.fields import GenericForeignKey
19+
import django
2020
from django.core.paginator import Page
2121
from django.db import models
2222
from django.forms import widgets
@@ -41,6 +41,11 @@
4141
except ImportError:
4242
from django.utils.datastructures import SortedDict as OrderedDict
4343

44+
if django.VERSION >= (1, 8):
45+
from django.contrib.contenttypes.fields import GenericForeignKey
46+
else:
47+
from django.contrib.contenttypes.generic import GenericForeignKey
48+
4449

4550
def _resolve_model(obj):
4651
"""

0 commit comments

Comments
 (0)