-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce the amount of queries from 11000 in admin to 14 (#157)
- Loading branch information
1 parent
efc273b
commit 9cc66bc
Showing
4 changed files
with
90 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from djangocms_moderation.models import ModerationCollection | ||
|
||
from .utils.base import BaseTestCase | ||
|
||
|
||
class CollectionManangerTest(BaseTestCase): | ||
|
||
def test_reviewers_wont_execute_too_many_queries(self): | ||
"""This works as a stop gap that will prevent any further changes to | ||
execute more than 9 queries for prefetching_reviweers""" | ||
with self.assertNumQueries(9): | ||
colls = ModerationCollection.objects.all().prefetch_reviewers() | ||
for collection in colls: | ||
ModerationCollection.objects.reviewers(collection) |