Opened 6 years ago
Closed 6 years ago
#29804 closed New feature (fixed)
Add 'Did you mean' suggestions for unsupported lookup error
Reported by: | Rich Jones | Owned by: | Abhinav Patil |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I often find myself running into django.core.exceptions.FieldError: Unsupported lookup 'is_null' for DateTimeField or join on the field not permitted.
- and it seems like plenty of other people on StackOverflow do as well.
It'd be great if we hit an unsupported lookup, we could suggest the correct one if if it's similar, so it'd become:
django.core.exceptions.FieldError: Unsupported lookup 'is_null' for DateTimeField or join on the field not permitted - did you mean isnull?
Thanks!
Change History (7)
comment:1 by , 6 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Summary: | Add 'Did You Mean' For Common Unsupported Lookups → Add 'Did you mean' suggestions for unsupported lookup error |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → New feature |
comment:2 by , 6 years ago
Is the purpose of this ticket to add "did you mean" suggestions for "django.core.exceptions.FieldError" only, or for any similar error?
comment:3 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Assuming the ticket refers only to errors of the form django.core.exceptions.FieldError: Unsupported lookup '<INCORRECT_FIELD>' for <SOME_MODEL> or join on the field not permitted.
, I believe I can add this feature, so I am assigning the ticket to myself.
comment:4 by , 6 years ago
I've submitted a pull request here: https://github.com/django/django/pull/10457
comment:7 by , 6 years ago
Has patch: | set |
---|
comment:8 by , 6 years ago
This is my first patch, so forgive me for what is probably a silly question, and I couldn't find anything concrete answering my question in the docs... anyways, the question: what happens now? Is there a process for getting this patch reviewed or is it along the lines of "just wait and someone will do it eventually"?
It seems worth exploring.
difflib
from the standard library seems promising for the example you gave: