Django

Code

Ticket #2513 (closed: wontfix)

Opened 2 years ago

Last modified 2 years ago

LazyDate better return date than datetime

Reported by: wangbin@exoweb.net Assigned to: adrian
Milestone: Component: django.contrib.admin
Version: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

lazydate.patch (500 bytes) - added by wangbin@exoweb.net on 08/10/06 00:18:54.
patch for django 0.95
lazydate.2.patch (452 bytes) - added by wangbin@exoweb.net on 08/10/06 00:23:25.
patch for django 0.91

Change History

08/10/06 00:18:54 changed by wangbin@exoweb.net

  • attachment lazydate.patch added.

patch for django 0.95

08/10/06 00:23:25 changed by wangbin@exoweb.net

  • attachment lazydate.2.patch added.

patch for django 0.91

08/12/06 00:18:25 changed by adrian

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

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

08/15/06 06:12:36 changed by Alex Dedul

  • status changed from closed to reopened.
  • resolution deleted.

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

08/15/06 06:19:15 changed by Alex Dedul

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

08/15/06 09:56:02 changed by adrian

  • status changed from reopened to closed.
  • resolution set to wontfix.

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)


Add/Change #2513 (LazyDate better return date than datetime)




Change Properties
Action