django-model-utils
django-model-utils copied to clipboard
Improve documentation for TimeStampedModel
The documentation TimeStampedModel is very minimal.
Some ideas for improvement:
- Note the path
model_utils.models.TimeStampedModel
- Document the
AutoCreatedField
andAutoLastModifiedField
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.
No argument from me!
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?
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.
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.