#32848: Bad error with invalid lookup on annotated field.
--------------------------------+--------------------------------------
Reporter: Gordon Wrigley | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 3.1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Comment (by João Freires):
I don't think that this ticket is closed. When we try to filter a Queryset
with an annotation, the resolution error is more accurate.
`MyModel.objects.annotate(bob=F("my_duration")).filter('bob__fred')`
Threw an accurate error message: "FieldError: Unsupported lookup
'fred'..."
But with:
`MyModel.objects.annotate(bob=F("my_duration")).values('bob__fred')`
I got: "FieldError: Cannot resolve keyword 'bob' into field."
I didn't try to evaluate how difficult is to do the same resolution in
Queryset's filter and values.
But I think that is good to keep the pattern and the two message errors
give a correct explanation.
--
Ticket URL: <https://code.djangoproject.com/ticket/32848#comment:4>
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/065.bd24a8753be153bbb23599d6e714423b%40djangoproject.com.