Django

Code

Ticket #7448 (closed: fixed)

Opened 6 months ago

Last modified 5 months ago

DateField + __in query = no query at all

Reported by: cgrady Assigned to: mtredinnick
Milestone: 1.0 Component: Database layer (models, ORM)
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 1 Patch needs improvement: 0

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

7448-datefield-in.patch (0.6 kB) - added by cgrady on 06/14/08 01:41:26.
7448-datefield-in.2.patch (0.6 kB) - added by cgrady on 06/14/08 01:46:07.

Change History

06/14/08 01:41:26 changed by cgrady

  • attachment 7448-datefield-in.patch added.

06/14/08 01:41:52 changed by cgrady

  • needs_better_patch changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

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

06/14/08 01:46:07 changed by cgrady

  • attachment 7448-datefield-in.2.patch added.

06/14/08 02:13:00 changed by cgrady

  • needs_tests set to 1.

07/10/08 12:47:44 changed by Karen Tracey <kmtracey@gmail.com>

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

07/10/08 12:48:10 changed by Karen Tracey <kmtracey@gmail.com>

  • milestone set to 1.0.

07/10/08 13:19:50 changed 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 :)

07/10/08 19:38:49 changed 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.

07/11/08 04:00:35 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(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.


Add/Change #7448 (DateField + __in query = no query at all)




Change Properties
Action