QuerySet.__contains__ needs documentation
|Reported by:||guettli||Owned by:||nobody|
|Cc:||hv@…, sebastian.goll@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The documentation should explain what happens in this code:
if obj in queryset: ....
If queryset is huge, the above code can be very slow.
If you want to run the code in the database, you should use this:
if queryset.filter(pk=obj.pk).exists(): ....
Can someone please provide a patch for the documentation. I am not a native speaker, and won't find the right words.
Change History (4)
comment:1 Changed 3 years ago by lukeplant
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted