1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

[5.0.x] Fixed #35426 -- Updated querysets to be a required argument of GenericPrefetch.

Backport of 9a27c76021 from main.
This commit is contained in:
sobolevn
2024-05-03 11:40:50 +03:00
committed by Sarah Boyce
parent ac9e18f1c4
commit 9b5029f048
4 changed files with 13 additions and 2 deletions

View File

@@ -333,6 +333,14 @@ class ContentTypesMultidbTests(TestCase):
class GenericPrefetchTests(TestCase):
def test_querysets_required(self):
msg = (
"GenericPrefetch.__init__() missing 1 required "
"positional argument: 'querysets'"
)
with self.assertRaisesMessage(TypeError, msg):
GenericPrefetch("question")
def test_values_queryset(self):
msg = "Prefetch querysets cannot use raw(), values(), and values_list()."
with self.assertRaisesMessage(ValueError, msg):