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!
--
Ticket URL: <https://code.djangoproject.com/ticket/29804>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* component: Uncategorized => Database layer (models, ORM)
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted
Comment:
It seems worth exploring. `difflib` from the standard library seems
promising for the example you gave:
{{{
>>> import difflib
>>> difflib.get_close_matches('is_null', ['isnull'])
['isnull']
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:1>
Comment (by Ubadub):
Is the purpose of this ticket to add "did you mean" suggestions for
"django.core.exceptions.FieldError" only, or for any similar error?
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:2>
* owner: nobody => Ubadub
* status: new => assigned
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:3>
Comment (by Abhinav Patil):
I've submitted a pull request here:
https://github.com/django/django/pull/10457
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:5>
* stage: Ready for checkin => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:6>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:7>
Comment (by Abhinav Patil):
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"?
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"bf01994a5ccc07cbe4b011b53b644eba04da052e" bf01994a]:
{{{
#!CommitTicketReference repository=""
revision="bf01994a5ccc07cbe4b011b53b644eba04da052e"
Fixed #29804 -- Added 'did you mean' suggestions for unsupported lookup
error.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29804#comment:9>