Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#7448 closed (fixed)

DateField + __in query = no query at all

Reported by: Collin Grady Owned by: Malcolm Tredinnick
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

There seems to be a problem with DateField and an __in query - in both sqlite and mysql (haven't tested postgres yet), it results in no query whatsoever

>>> Bar.objects.filter(b__in=[date(2008, 6, 9), date(2008, 6, 10), date(2008, 6, 12)])
[]
>>> connection.queries
[]

investigating further, will post more info if I get it

Attachments (2)

7448-datefield-in.patch (662 bytes) - added by Collin Grady 8 years ago.
7448-datefield-in.2.patch (648 bytes) - added by Collin Grady 8 years ago.

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by Collin Grady

Attachment: 7448-datefield-in.patch added

comment:1 Changed 8 years ago by Collin Grady

Has patch: set
Triage Stage: UnreviewedAccepted

there's probably a better way to do this, but this patch fixes the issue :)

Changed 8 years ago by Collin Grady

Attachment: 7448-datefield-in.2.patch added

comment:2 Changed 8 years ago by Collin Grady

Needs tests: set

comment:3 Changed 8 years ago by Karen Tracey <kmtracey@…>

#7707 is a dup but contains a patch with a test that might be useful since this one has needs_tests set to 1.

comment:4 Changed 8 years ago by Karen Tracey <kmtracey@…>

milestone: 1.0

comment:5 Changed 8 years ago by Collin Grady

someone was supposed to be attaching a better patch to this one, but it appears to be taking a little longer than planned :)

comment:6 Changed 8 years ago by Malcolm Tredinnick

Owner: changed from nobody to Malcolm Tredinnick

I'll tackle this today. No need to attach the patch from the other ticket. I'll review that in the normal process of things.

comment:7 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [7883]) Fixed #7448 -- Convert "in" filters to pass in the correct values for datetimes
and similar complex objects.

Based on patches from cgrady and alexkosholev. Refs #7707.

comment:6 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top