synthea_webservice/webservice/lib/models/base.py

20 lines
865 B
Python

from django.db import models
from django.utils.translation import gettext_lazy as _
class MetaDataModel(models.Model):
"""
This is an abstract Django model with some general meta fields that can be used for other models.
Attributes
----------
created_at : datetime
The date and time when the model has been created. This will be automatically set once during creating.
updated_at : datetime
The date and time when the model has been updated. This will be automatically updated when the model is updated.
"""
created_at = models.DateTimeField(_('Date created'),auto_now_add=True, help_text=_('The date and time this model has been created'))
updated_at = models.DateTimeField(_('Date updated'),auto_now=True, help_text=_('The date and time this model has been updated'))
class Meta:
abstract = True