mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Fix django deprecation warnings (#4712)
This commit is contained in:
parent
9f4c9691f4
commit
6498766749
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue
Block a user