Opened 18 years ago

Closed 18 years ago

#2513 closed defect (wontfix)

LazyDate better return date than datetime

Reported by: wangbin@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

We have model has a DateField called expire_date which set default to LazyDate(days=60), it works well in firefox, but under safari and IE it shows error when we save that object, because LazyDate.get_value method return datetime object, wich make the validation fails, I think it is better to return date object, which will be useful both to DateField and DateTimeField.

Attachments (2)

lazydate.patch (500 bytes ) - added by wangbin@… 18 years ago.
patch for django 0.95
lazydate.2.patch (452 bytes ) - added by wangbin@… 18 years ago.
patch for django 0.91

Download all attachments as: .zip

Change History (6)

by wangbin@…, 18 years ago

Attachment: lazydate.patch added

patch for django 0.95

by wangbin@…, 18 years ago

Attachment: lazydate.2.patch added

patch for django 0.91

comment:1 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [3566]) Fixed #2513 -- Changed LazyDate.get_value() to return date objects, not datetime objects

comment:2 by Alex Dedul, 18 years ago

Resolution: fixed
Status: closedreopened

Hm, for DateTimeField with default it sets time to 00:00 requiring users to manually set time everytime. Maybe add another class LazyDateTime ?

comment:3 by Alex Dedul, 18 years ago

Or even better revert LazyDate and fix the validation where needed ?

comment:4 by Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: reopenedclosed

LazyDate is eventually going away, in favor of callable arguments, so I'm marking this as wontfix.

Old:

default=LazyDate().

New:

default=datetime.date.today

Old:

default=LazyDate(days=1)

New:

default=lambda: datetime.date.today() + datetime.timedelta(days=1)

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