[Django] #35413: FieldError: Unsupported lookup error message can be confusing on DateTimeField

8 views
Skip to first unread message

Django

unread,
Apr 29, 2024, 6:53:36 AMApr 29
to django-...@googlegroups.com
#35413: FieldError: Unsupported lookup error message can be confusing on
DateTimeField
-------------------------------------+-------------------------------------
Reporter: Alex | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
On these example queries on DateTimeFields:

{{{
TestModel.objects.filter(created_at__gt__foo='2024-01-01')
TestModel.objects.filter(created_at__gt__='2024-01-01') # I'm a bit
surprised this one also has the same message.
TestModel.objects.filter(created_at__gt__lt='2024-01-01')
}}}
The error message is this
{{{
django.core.exceptions.FieldError: Unsupported lookup 'gt' for
DateTimeField or join on the field not permitted, perhaps you meant gt or
gte?
}}}

The error message should clarify better the issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/35413>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages