Fix django deprecation warnings (#4712)

This commit is contained in:
Ryan P Kilby 2016-11-29 04:49:18 -05:00 committed by Tom Christie
parent 9f4c9691f4
commit 6498766749
2 changed files with 4 additions and 3 deletions

View File

@ -94,7 +94,7 @@ class Issue3674ParentModel(models.Model):
class Issue3674ChildModel(models.Model):
parent = models.ForeignKey(Issue3674ParentModel, related_name='children')
parent = models.ForeignKey(Issue3674ParentModel, related_name='children', on_delete=models.CASCADE)
value = models.CharField(primary_key=True, max_length=64)
@ -1013,7 +1013,7 @@ class Issue3674Test(TestCase):
title = models.CharField(max_length=64)
class TestChildModel(models.Model):
parent = models.ForeignKey(TestParentModel, related_name='children')
parent = models.ForeignKey(TestParentModel, related_name='children', on_delete=models.CASCADE)
value = models.CharField(primary_key=True, max_length=64)
class TestChildModelSerializer(serializers.ModelSerializer):

View File

@ -2,6 +2,7 @@ from django.contrib.auth.models import Group, User
from django.test import TestCase
from rest_framework import generics, serializers
from rest_framework.compat import set_many
from rest_framework.test import APIRequestFactory
factory = APIRequestFactory()
@ -22,7 +23,7 @@ class TestPrefetchRelatedUpdates(TestCase):
def setUp(self):
self.user = User.objects.create(username='tom', email='tom@example.com')
self.groups = [Group.objects.create(name='a'), Group.objects.create(name='b')]
self.user.groups = self.groups
set_many(self.user, 'groups', self.groups)
self.user.save()
def test_prefetch_related_updates(self):