Opened 9 years ago

Closed 6 years ago

#2471 closed defect (invalid)

[patch] date_based generic view doesn't work with DateField and sqlite

Reported by: Steven Armstrong Owned by: nobody
Component: Generic views Version: master
Severity: major Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

Environment:
Python 2.4.2
sqlite3 3.2.1
pysqlite 2.3.1

Attachments (2)

date-based-generic-view_date-field.diff (1.7 KB) - added by Steven Armstrong 9 years ago.
bug_2471.tar (4.2 KB) - added by hughdbrown@… 6 years ago.
Tar ball of Django app that shows non-reproducibility of bug

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by Steven Armstrong

comment:1 Changed 9 years ago by Steven Armstrong

In MySQL and friends a DateField is represented as '2006-08-07 00:00:00'
while in sqlite it's just '2006-08-07'.

The patch changes the archive_day view (django/views/generic/date_based.py) to test if it's dealing with a DateField or a DateTimeField and build the sql lookup args depending on that.

comment:2 Changed 9 years ago by jarek.zgoda@…

This patch works also for me, I had the same problem with date/datetime fields in SQLite3. See this thread on googlegroups.

comment:3 Changed 9 years ago by adrian

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

(In [3633]) Fixed #2471 -- Got date-based generic views working with SQLite DateFields. Thanks for the patch, Steven Armstrong

comment:4 Changed 9 years ago by js(AT)shezi.de

  • Resolution fixed deleted
  • Status changed from closed to reopened

The bug persists in the newest version (subversion 3916) with sqlite-3.3.5, pysqlite-2.3.1, python-2.4.3

comment:5 Changed 9 years ago by Gary Wilson <gary.wilson@…>

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

Patch must need improvement if the bug persists :)

Changed 6 years ago by hughdbrown@…

Tar ball of Django app that shows non-reproducibility of bug

comment:6 Changed 6 years ago by anonymous

  • Resolution set to invalid
  • Status changed from reopened to closed

Bug not reproducible with python 2.6, sqlite3, and jango-trunk. See attached tar ball.

python manage.py syncdb
python manage.py runserver

http://localhost:8000/bug/archive/2009/sep/11/

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