Skip to content

Fix NoReverseMatch import for Django >= 2.0 #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rest_framework_json_api/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import json
from collections import OrderedDict

import django
import inflection
import six
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers 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
Expand All @@ -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',
Expand Down