[Fixed]-Django does django have an automatic timestamp create/update field like cakephp?

23👍

Sure it has!

Check auto_now and auto_now_add in the doc

👤okm

33👍

It is not added to your model built-in in every table. You must add it as field to your model.

class Message(models.Model):

    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

Message in this case your table’s name.

Leave a comment