-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed "Don't overuse count() or exists()" example to Python #13294
Changed "Don't overuse count() or exists()" example to Python #13294
Conversation
This does seem nice but instead of removing the existing snippet, how about just adding this one along with that? |
I think keeping both versions is just bloat. Anyone who understands the Python version and how templates work should be able to understand how the problem can appear in templates too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamchainz Thanks 👍
ae2dd32
to
c338fe1
Compare
c338fe1
to
8a642b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamchainz Thanks 👍 I pushed minor edits.
docs/topics/db/optimization.txt
Outdated
@@ -261,46 +261,38 @@ Don't overuse ``count()`` and ``exists()`` | |||
If you are going to need other data from the QuerySet, evaluate it immediately. | |||
|
|||
For example, assuming an Email model that has a ``body`` attribute and a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For example, assuming an Email model that has a ``body`` attribute and a | |
For example, assuming an Email model that has a ``subject`` attribute and a |
Many Django developers don't use templates these days, instead working on API's. The ORM is the common denominator, and I think the plain Python makse the example a littl clearer.