mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user