From 847f46e9bf88964484c8b76a10af753ea1018311 Mon Sep 17 00:00:00 2001 From: Nick Pope Date: Tue, 22 Feb 2022 09:29:38 +0000 Subject: Removed redundant QuerySet.all() calls in docs and tests. Most QuerySet methods are mapped onto the Manager and, in general, it isn't necessary to call .all() on the manager. --- tests/model_forms/tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/model_forms') diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 592bc693af..13b871372e 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -1617,7 +1617,7 @@ class ModelFormBasicTests(TestCase): # Set up a callable initial value def formfield_for_dbfield(db_field, **kwargs): if db_field.name == "categories": - kwargs["initial"] = lambda: Category.objects.all().order_by("name")[:2] + kwargs["initial"] = lambda: Category.objects.order_by("name")[:2] return db_field.formfield(**kwargs) # Create a ModelForm, instantiate it, and check that the output is as expected -- cgit v1.3