Skip to content

Commit b3e03cd

Browse files
author
kazmiruk
committed
fixes broken test + importlib warnings
1 parent 47c6167 commit b3e03cd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

rest_framework/serializers.py

Lines changed: 4 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.generic import GenericForeignKey
19+
from django.contrib.contenttypes.fields import GenericForeignKey
2020
from django.core.paginator import Page
2121
from django.db import models
2222
from django.forms import widgets
@@ -114,6 +114,9 @@ class OrderedDictWithMetadata(OrderedDict):
114114
"""
115115
A sorted dict-like object, that can have additional properties attached.
116116
"""
117+
def __reduce__(self):
118+
return self.__class__, (OrderedDict(self), )
119+
117120
def __getstate__(self):
118121
"""
119122
Used by pickle (e.g., caching).

rest_framework/settings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@
1919
"""
2020
from __future__ import unicode_literals
2121
from django.conf import settings
22-
from django.utils import importlib, six
22+
from django.utils import six
2323
from rest_framework import ISO_8601
2424

25+
try:
26+
import importlib
27+
except ImportError:
28+
from django.utils import importlib
29+
2530

2631
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None)
2732

0 commit comments

Comments
 (0)