django-model-utils icon indicating copy to clipboard operation
django-model-utils copied to clipboard

Improve documentation for TimeStampedModel

Open treyhunner opened this issue 10 years ago • 4 comments

The documentation TimeStampedModel is very minimal.

Some ideas for improvement:

  • Note the path model_utils.models.TimeStampedModel
  • Document the AutoCreatedField and AutoLastModifiedField fields officially
  • Note the difference between auto_now/auto_now_add and the fields used in django-model-utils

With the recently proposed deprecation of auto_now and auto_now_add, I think documenting AutoCreatedField and AutoLastModifiedField is even more important.

treyhunner avatar Jul 10 '14 19:07 treyhunner

No argument from me!

carljm avatar Jul 11 '14 00:07 carljm

So, what is the difference between the two? I had to Google "TimeStampedModel" "auto_now_add" to find this issue and I still don't get it. The proposed deprecation doesn't seem to be happening - what is the point of using AutoCreatedField / AutoLastModifiedField instead of the native Django functionality?

jleclanche avatar Feb 27 '17 03:02 jleclanche

auto_now/auto_now_add are documented as "updated only on Model.save()" IIRC, e.g. Model.objects.filter(...).update(...) won't trigger Model.save(), so those fields will remain unchanged, unlike (AIUI) AutoCreatedField/AutoLastModifiedField.

dimitern avatar Feb 22 '18 20:02 dimitern

Thanks @dimitern! This should be really noted in docs. Despite working for ages with Django I've had to dig into it to see the difference.

pySilver avatar Feb 12 '21 01:02 pySilver