March 2020
Intermediate to advanced
608 pages
17h 17m
English
Open the models.py file in your myprojects.apps.core package, and insert the following content there:
# myproject/apps/core/models.pyfrom django.db import modelsfrom django.utils.translation import gettext_lazy as _class CreationModificationDateBase(models.Model): """ Abstract base class with a creation and modification date and time """ created = models.DateTimeField( _("Creation Date and Time"), auto_now_add=True, ) modified = models.DateTimeField( _("Modification Date and Time"), auto_now=True, ) class Meta: abstract = True
Read now
Unlock full access