Last active
December 24, 2015 06:49
-
-
Save ishahid/6759595 to your computer and use it in GitHub Desktop.
An abstract base class model for Django that provides self-updating 'created' and 'modified' fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class TimeStampedModel(models.Model): | |
""" | |
An abstract base class model that provides self-updating 'created' | |
and 'modified' fields. | |
""" | |
created = models.DateTimeField(auto_now_add=True) | |
modified = models.DateTimeField(auto_now=True) | |
class Meta: | |
abstract = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment