Code

Opened 5 years ago

Closed 5 years ago

#10602 closed (invalid)

Proposal / Fix: auto_now should set a date for DateField

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

Description

For a DateField, if auto_now is enabled, a datetime value (datetime.datetime.now()) is inserted - which will make some queries more complicated.

The attached patch "fixes" that behaviour by inserting datetime.date.today() for DateField instances
and datetime.datetime.now() for DateTimeField instances.

But perhaps this is intended, since you can use datetime.date.today as the default parameter.

Attachments (1)

auto_now.diff (1.2 KB) - added by HuCy 5 years ago.

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by HuCy

comment:1 Changed 5 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

I'm not sure what you mean by "makes queries more complicated"; since there doesn't seem to be a bug here I'm closing the ticket.

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.