#25508 closed Cleanup/optimization (fixed)
Add "QuerySet()" to QuerySet.__repr__ to help debugging
| Reported by: | Tim Graham | Owned by: | Tim Graham |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
TransactionTestCase.assertQuerysetEqual can give errors like AssertionError: ['1.8', '1.7', '1.4'] != ['1.8', '1.7', '1.4'] when you compare a list and a QuerySet. Alex proposed to change the repr of QuerySet to QuerySet([...]) and the idea received several +1's in #django-dev.
Change History (8)
comment:1 by , 10 years ago
| Has patch: | set |
|---|
comment:2 by , 10 years ago
Agreed it's a good idea. However, the docs might have to be updated in many places, for example in https://docs.djangoproject.com/en/1.8/topics/db/examples/many_to_many/.
git grep "\[<" gives an indication about where docs might need en update.
comment:3 by , 10 years ago
Thanks for pointing that out and providing the grep hint. Docs are now updated.
comment:4 by , 10 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
PR