#34012: QuerySet.order_by() silently skips non-existing fields on related
fields.
-------------------------------------+-------------------------------------
Reporter: Klaas van Schelven | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Sanders):
* cc: David Sanders (added)
Comment:
fwiw I can't reproduce the issue on 4.1.1 🤔 …
Here's what I tried (full tracebacks omitted for brevity):
{{{
class Parent(Model):
...
class Child(Model):
parent = ForeignKey(Parent, on_delete=CASCADE)
Child.objects.all().order_by('asdf')
FieldError: Cannot resolve keyword 'asdf' into field. Choices are: id,
parent, parent_id
Child.objects.all().order_by('parent__id')
<QuerySet []>
Child.objects.all().order_by('parent__asdf')
FieldError: Unsupported lookup 'asdf' for BigAutoField or join on the
field not permitted, perhaps you meant df?
During handling of the above exception, another exception occurred:
FieldError: Cannot resolve keyword 'asdf' into field. Choices are: child,
id
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34012#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018346a43017-db803b27-c6c2-4903-80d1-d8b74b8301e9-000000%40eu-central-1.amazonses.com.