Opened 10 years ago
Closed 10 years ago
#23697 closed Cleanup/optimization (fixed)
Confusing exception raised upon unknown field in queryset filter argument
Reported by: | Markus Bertheau | Owned by: | Michael Blatherwick |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.7 |
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
Choice.objects.filter(question__qestion_text__icontains='foo')
#################### typo here: ^^
raises
File "/home/markus/src/django/django/db/models/sql/query.py", line 1181, in build_filter lookups, value) File "/home/markus/src/django/django/db/models/fields/related.py", line 1514, in get_lookup_constraint raise exceptions.FieldError('Relation fields do not support nested lookups') FieldError: Relation fields do not support nested lookups
Which is very confusing. Is a better error message possible?
(This might have been the original cause of #23351.)
Change History (7)
comment:1 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 10 years ago
#23351 was a duplicate which manifested itself in the admins search_fields
references.
comment:4 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
Better error messages are always welcome. I believe we could throw away the current error message and instead tell the user which fields are available. This would match pre-1.7 error message.