From 3f8ed7fed729a8ab88f5d35c16538eb5351ade24 Mon Sep 17 00:00:00 2001 From: Dmitry Gribanov Date: Sun, 12 Mar 2023 22:03:54 +0300 Subject: [PATCH] Fix test warnings --- tests/test_regressions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_regressions.py b/tests/test_regressions.py index 1cc7f912..d120baec 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -3039,31 +3039,31 @@ class XViewset(viewsets.ModelViewSet): def test_serializer_foreign_key_default_value_handling(no_warnings): - class M10(models.Model): + class M12(models.Model): field = models.CharField(unique=True) - class M11(models.Model): - field_related = models.ForeignKey(M10, on_delete=models.CASCADE, default=1) + class M13(models.Model): + field_related = models.ForeignKey(M12, on_delete=models.CASCADE, default=1) class XSerializer(serializers.ModelSerializer): field_related = serializers.PrimaryKeyRelatedField( - queryset=M11.objects.all(), + queryset=M13.objects.all(), default=1, ) field_related_slug = serializers.SlugRelatedField( source='field_related', slug_field='field', - queryset=M10.objects.all(), + queryset=M12.objects.all(), default='foo', ) class Meta: fields = '__all__' - model = M11 + model = M13 class XViewset(viewsets.ModelViewSet): serializer_class = XSerializer - queryset = M11.objects.none() + queryset = M13.objects.none() schema = generate_schema('/x', XViewset) assert schema['components']['schemas']['X']['properties'] == {