Repository: django-json-api/django-rest-framework-json-api

Issue:
Add support for Django REST Framework 3.7 and Django 2.0
DJA should be tested against DRF 3.7.x and document that support.


Discussion:

Resolving patch:
diff --git a/example/models.py b/example/models.py
--- a/example/models.py
+++ b/example/models.py
@@ -60,7 +60,7 @@ class Meta:
 class Author(BaseModel):
     name = models.CharField(max_length=50)
     email = models.EmailField()
-    type = models.ForeignKey(AuthorType, null=True)
+    type = models.ForeignKey(AuthorType, null=True, on_delete=models.CASCADE)
 
     def __str__(self):
         return self.name
@@ -71,7 +71,7 @@ class Meta:
 
 @python_2_unicode_compatible
 class AuthorBio(BaseModel):
-    author = models.OneToOneField(Author, related_name='bio')
+    author = models.OneToOneField(Author, related_name='bio', on_delete=models.CASCADE)
     body = models.TextField()
 
     def __str__(self):
@@ -83,7 +83,7 @@ class Meta:
 
 @python_2_unicode_compatible
 class Entry(BaseModel):
-    blog = models.ForeignKey(Blog)
+    blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
     headline = models.CharField(max_length=255)
     body_text = models.TextField(null=True)
     pub_date = models.DateField(null=True)
@@ -103,12 +103,13 @@ class Meta:
 
 @python_2_unicode_compatible
 class Comment(BaseModel):
-    entry = models.ForeignKey(Entry, related_name='comments')
+    entry = models.ForeignKey(Entry, related_name='comments', on_delete=models.CASCADE)
     body = models.TextField()
     author = models.ForeignKey(
         Author,
         null=True,
-        blank=True
+        blank=True,
+        on_delete=models.CASCADE,
     )
 
     def __str__(self):
@@ -133,7 +134,8 @@ class ResearchProject(Project):
 @python_2_unicode_compatible
 class Company(models.Model):
     name = models.CharField(max_length=100)
-    current_project = models.ForeignKey(Project, related_name='companies')
+    current_project = models.ForeignKey(
+        Project, related_name='companies', on_delete=models.CASCADE)
     future_projects = models.ManyToManyField(Project)
 
     def __str__(self):
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -108,7 +108,7 @@ def get_package_data(package):
         'factory-boy<2.9.0',
         'pytest-django',
         'pytest>=2.8,<3',
-        'django-polymorphic',
+        'django-polymorphic>=2.0',
         'packaging',
         'django-debug-toolbar'
     ] + mock,


Test patch:
diff --git a/example/tests/integration/test_includes.py b/example/tests/integration/test_includes.py
--- a/example/tests/integration/test_includes.py
+++ b/example/tests/integration/test_includes.py
@@ -1,5 +1,5 @@
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from example.tests.utils import load_json
 
diff --git a/example/tests/integration/test_meta.py b/example/tests/integration/test_meta.py
--- a/example/tests/integration/test_meta.py
+++ b/example/tests/integration/test_meta.py
@@ -1,7 +1,7 @@
 from datetime import datetime
 
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from example.tests.utils import load_json
 
diff --git a/example/tests/integration/test_model_resource_name.py b/example/tests/integration/test_model_resource_name.py
--- a/example/tests/integration/test_model_resource_name.py
+++ b/example/tests/integration/test_model_resource_name.py
@@ -1,7 +1,7 @@
 from copy import deepcopy
 
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from rest_framework import status
 
 from example import models, serializers, views
diff --git a/example/tests/integration/test_non_paginated_responses.py b/example/tests/integration/test_non_paginated_responses.py
--- a/example/tests/integration/test_non_paginated_responses.py
+++ b/example/tests/integration/test_non_paginated_responses.py
@@ -1,5 +1,5 @@
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from rest_framework_json_api.pagination import PageNumberPagination
 
diff --git a/example/tests/integration/test_pagination.py b/example/tests/integration/test_pagination.py
--- a/example/tests/integration/test_pagination.py
+++ b/example/tests/integration/test_pagination.py
@@ -1,5 +1,5 @@
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from example.tests.utils import load_json
 
diff --git a/example/tests/integration/test_polymorphism.py b/example/tests/integration/test_polymorphism.py
--- a/example/tests/integration/test_polymorphism.py
+++ b/example/tests/integration/test_polymorphism.py
@@ -2,7 +2,7 @@
 import random
 
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from example.tests.utils import load_json
 
diff --git a/example/tests/integration/test_sparse_fieldsets.py b/example/tests/integration/test_sparse_fieldsets.py
--- a/example/tests/integration/test_sparse_fieldsets.py
+++ b/example/tests/integration/test_sparse_fieldsets.py
@@ -1,5 +1,5 @@
 import pytest
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 pytestmark = pytest.mark.django_db
 
diff --git a/example/tests/test_format_keys.py b/example/tests/test_format_keys.py
--- a/example/tests/test_format_keys.py
+++ b/example/tests/test_format_keys.py
@@ -1,5 +1,5 @@
 from django.contrib.auth import get_user_model
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from django.utils import encoding
 
 from example.tests import TestBase
diff --git a/example/tests/test_generic_validation.py b/example/tests/test_generic_validation.py
--- a/example/tests/test_generic_validation.py
+++ b/example/tests/test_generic_validation.py
@@ -1,4 +1,4 @@
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from example.tests import TestBase
 from example.tests.utils import load_json
diff --git a/example/tests/test_generic_viewset.py b/example/tests/test_generic_viewset.py
--- a/example/tests/test_generic_viewset.py
+++ b/example/tests/test_generic_viewset.py
@@ -1,5 +1,5 @@
 from django.conf import settings
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 
 from example.tests import TestBase
 from example.tests.utils import load_json
diff --git a/example/tests/test_model_viewsets.py b/example/tests/test_model_viewsets.py
--- a/example/tests/test_model_viewsets.py
+++ b/example/tests/test_model_viewsets.py
@@ -1,7 +1,7 @@
 import pytest
 from django.conf import settings
 from django.contrib.auth import get_user_model
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from django.utils import encoding
 
 from example.tests import TestBase
diff --git a/example/tests/test_multiple_id_mixin.py b/example/tests/test_multiple_id_mixin.py
--- a/example/tests/test_multiple_id_mixin.py
+++ b/example/tests/test_multiple_id_mixin.py
@@ -1,6 +1,6 @@
 import json
 
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from django.utils import encoding
 
 from example.tests import TestBase
diff --git a/example/tests/test_serializers.py b/example/tests/test_serializers.py
--- a/example/tests/test_serializers.py
+++ b/example/tests/test_serializers.py
@@ -1,6 +1,6 @@
 import pytest
-from django.core.urlresolvers import reverse
 from django.test import TestCase
+from django.urls import reverse
 from django.utils import timezone
 
 from rest_framework_json_api.serializers import ResourceIdentifierObjectSerializer
diff --git a/example/tests/test_sideload_resources.py b/example/tests/test_sideload_resources.py
--- a/example/tests/test_sideload_resources.py
+++ b/example/tests/test_sideload_resources.py
@@ -3,7 +3,7 @@
 """
 import json
 
-from django.core.urlresolvers import reverse
+from django.urls import reverse
 from django.utils import encoding
 
 from example.tests import TestBase