Skip to content

Commit

Permalink
fix comment typos
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Dec 15, 2023
1 parent 390d2c5 commit f941625
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions docs/changelog.rst
Expand Up @@ -5,8 +5,7 @@ Changelog
------------------

- Nothing changed yet.
- Remove unnecessary queries to speed up export
This is done by overriding `ChangeList` from `ModelAdmin.get_changelist().get_results()` with stub method.
- Remove unnecessary ChangeList queries to speed up export via Admin UI (#1715)

3.3.4 (2023-12-09)
------------------
Expand Down
10 changes: 5 additions & 5 deletions import_export/admin.py
Expand Up @@ -745,17 +745,17 @@ def get_export_queryset(self, request):
class ExportChangeList(ChangeList):
def get_results(self, request):
"""
We override this method because we only call ChangeList.get_queryset()
so we don't need anything from this method.
The get_results() gets called during ChangeList.__init__()
and we do want to avoid unnecessary COUNT queries.
Overrides ChangeList.get_results() to bypass default operations like
pagination and result counting, which are not needed for export. This
prevents executing unnecessary COUNT queries during ChangeList
initialization.
"""
pass

cl = ExportChangeList(**changelist_kwargs)

# get_queryset() is already called during initialization,
# it is enough to get it's results
# it is enough to get its results
if hasattr(cl, "queryset"):
return cl.queryset

Expand Down
2 changes: 1 addition & 1 deletion tests/core/tests/test_admin_integration.py
Expand Up @@ -726,7 +726,7 @@ def get_queryset(self, request):
self.assertEqual(queryset.count(), Book.objects.count())

def test_get_export_queryset_no_queryset_init(self):
"""Test if user has own ChangeList which doesn't store queryset diring init"""
"""Test if user has own ChangeList which doesn't store queryset during init"""
model_admin = BookAdmin(Book, AdminSite())

factory = RequestFactory()
Expand Down

0 comments on commit f941625

Please sign in to comment.