Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#7448 closed (fixed)

DateField + __in query = no query at all

Reported by: cgrady Owned by: mtredinnick
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 cgrady 6 years ago.
7448-datefield-in.2.patch (648 bytes) - added by cgrady 6 years ago.

Download all attachments as: .zip

Change History (10)

Changed 6 years ago by cgrady

comment:1 Changed 6 years ago by cgrady

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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

Changed 6 years ago by cgrady

comment:2 Changed 6 years ago by cgrady

  • Needs tests set

comment:3 Changed 6 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 6 years ago by Karen Tracey <kmtracey@…>

  • milestone set to 1.0

comment:5 Changed 6 years ago by cgrady

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 6 years ago by mtredinnick

  • Owner changed from nobody to mtredinnick

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 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(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 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.