diff --git a/rest_framework_json_api/relations.py b/rest_framework_json_api/relations.py index e90b4380..7d13c747 100644 --- a/rest_framework_json_api/relations.py +++ b/rest_framework_json_api/relations.py @@ -2,10 +2,10 @@ import json from collections import OrderedDict +import django import inflection import six from django.core.exceptions import ImproperlyConfigured -from django.urls import NoReverseMatch from django.utils.translation import ugettext_lazy as _ from rest_framework.fields import MISSING_ERROR_MESSAGE from rest_framework.relations import MANY_RELATION_KWARGS, PrimaryKeyRelatedField @@ -21,6 +21,11 @@ get_resource_type_from_serializer ) +if django.VERSION >= (1, 10): + from django.urls import NoReverseMatch +else: + from django.core.urlresolvers import NoReverseMatch + LINKS_PARAMS = [ 'self_link_view_name', 'related_link_view_name',