August 2016
Beginner to intermediate
717 pages
15h 24m
English
It is a common behavior to have timestamps in your models for the creation and modification of your model instances. In this recipe, we will see how to create a simple model mixin that saves the creation and modification dates and times for your model. Using such a mixin will ensure that all the models use the same field names for the timestamps and have the same behavior.
If you haven't done this yet, create the utils package to save your mixins. Then, create the models.py file in the utils package.
Open the models.py file of your utils package and insert the following content there:
# utils/models.py # -*- coding: UTF-8 -*- from __future__ import unicode_literals ...
Read now
Unlock full access