Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

Automatic Created and Updated DateTime Fields for Django Models

I'm leaving this to my future self, as I keep forgetting it over and over again.

If you want to add "create" and "update" time logging to your model, it's as simple as:

from django.db import models

class Task(models.Model):

    created = models.DateTimeField(auto_now_add=True)

    updated ...

Read now

Don't be the product, buy the product!