Opened 16 years ago

Closed 16 years ago

Last modified 13 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: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

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 16 years ago.
7448-datefield-in.2.patch (648 bytes ) - added by Collin Grady 16 years ago.

Download all attachments as: .zip

Change History (10)

by Collin Grady, 16 years ago

Attachment: 7448-datefield-in.patch added

comment:1 by Collin Grady, 16 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

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

by Collin Grady, 16 years ago

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

comment:2 by Collin Grady, 16 years ago

Needs tests: set

comment:3 by Karen Tracey <kmtracey@…>, 16 years ago

#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 by Karen Tracey <kmtracey@…>, 16 years ago

milestone: 1.0

comment:5 by Collin Grady, 16 years ago

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 by Malcolm Tredinnick, 16 years ago

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 by Malcolm Tredinnick, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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