Django

Code

Ticket #6434 (new)

Opened 11 months ago

Last modified 4 months ago

auto_now and auto_now_add should me marked for soon-to-be-deprecated

Reported by: jokull@radgjafahus.is Assigned to: nobody
Milestone: Component: Documentation
Version: SVN Keywords: datefield auto_now auto_now_add
Cc: mk@spinlock.ch Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 1

Description

http://www.djangoproject.com/documentation/model-api/#datefield[[BR]] The datetime.datetime.now and datetime.date.today callables or a field subclass should probably be suggested to meet these needs.

Attachments

6434-dyn.patch (6.7 kB) - added by mk on 07/25/08 09:52:25.

Change History

03/17/08 14:25:14 changed by Alex

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Adding a default doesn't exactly do the same thing, you would also need to override the save method of the model(especially for auto_now), I also agree they should be deprecated, however we need to document the alternative.

06/08/08 07:39:26 changed by jacob

  • stage changed from Unreviewed to Accepted.

07/25/08 09:52:25 changed by mk

  • attachment 6434-dyn.patch added.

07/25/08 09:56:17 changed by mk

  • cc set to mk@spinlock.ch.
  • keywords changed from datefield to datefield auto_now auto_now_add.
  • has_patch set to 1.
  • needs_better_patch set to 1.

Some documentation is included but it's _very_ lacking. As per the discussion in a mailing list thread[1] I added Auto[Add]{Date,DateTime?,Time}Field classes to django/db/models/fields/init.py

I think this functionality is used often and therefore might deserve a place in Django proper.

[1]: http://groups.google.com/group/django-developers/browse_thread/thread/4cd631c225cb4e52


Add/Change #6434 (auto_now and auto_now_add should me marked for soon-to-be-deprecated)




Change Properties
Action