Opened 18 years ago

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

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 18 years ago.
bug_2471.tar (4.2 KB ) - added by hughdbrown@… 15 years ago.
Tar ball of Django app that shows non-reproducibility of bug

Download all attachments as: .zip

Change History (8)

by Steven Armstrong, 18 years ago

comment:1 by Steven Armstrong, 18 years ago

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 by jarek.zgoda@…, 18 years ago

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

comment:3 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

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

comment:4 by js(AT)shezi.de, 17 years ago

Resolution: fixed
Status: closedreopened

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

comment:5 by Gary Wilson <gary.wilson@…>, 17 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Patch must need improvement if the bug persists :)

by hughdbrown@…, 15 years ago

Attachment: bug_2471.tar added

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

comment:6 by anonymous, 15 years ago

Resolution: invalid
Status: reopenedclosed

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