fixes broken test + importlib warnings

This commit is contained in:
kazmiruk 2015-04-22 19:52:23 +07:00
parent 47c61679a5
commit b3e03cd8e2
2 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,7 @@ import datetime
import inspect import inspect
import types import types
from decimal import Decimal from decimal import Decimal
from django.contrib.contenttypes.generic import GenericForeignKey from django.contrib.contenttypes.fields import GenericForeignKey
from django.core.paginator import Page from django.core.paginator import Page
from django.db import models from django.db import models
from django.forms import widgets from django.forms import widgets
@ -114,6 +114,9 @@ class OrderedDictWithMetadata(OrderedDict):
""" """
A sorted dict-like object, that can have additional properties attached. A sorted dict-like object, that can have additional properties attached.
""" """
def __reduce__(self):
return self.__class__, (OrderedDict(self), )
def __getstate__(self): def __getstate__(self):
""" """
Used by pickle (e.g., caching). Used by pickle (e.g., caching).

View File

@ -19,9 +19,14 @@ back to the defaults.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
from django.conf import settings from django.conf import settings
from django.utils import importlib, six from django.utils import six
from rest_framework import ISO_8601 from rest_framework import ISO_8601
try:
import importlib
except ImportError:
from django.utils import importlib
USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None) USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK', None)