Code

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1754 closed defect (fixed)

[patch] models.DateField should allow string lookups

Reported by: Esaj Owned by: adrian
Component: Database layer (models, ORM) Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

At the moment DateField.get_db_prep_lookup assumes that values passed to it are datetime objects when doing certain lookup types.

This patch falls back to using str(value), which means that various date lookup queries can work in the admin changelist.

Attachments (1)

__init__.py.diff (648 bytes) - added by Esaj 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by Esaj

comment:1 Changed 8 years ago by mtredinnick

See also #2211. Not sure which patch is better at the moment.

comment:2 Changed 8 years ago by mtredinnick

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

(In [3223]) Fixed #1754, #2211, #2192 -- allow date filtering comparisons to use strings as
well as date objects. Fixed a couple of admin crashes as well.

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.