This package contains a single useful base model I was copying over and over onto every new project. It was time to package it up and reuse it.
This is a basic model from which all the project's model should inherit. It is defined as "abstract".
It defines a couple of basic fields every model should have:
-
an ID as CharField/NanoID: this avoids that content could be "discovered" if using auto increment and instead is a better UUID
-
created_at: a datetime field with "auto_now_add", so we track when the model was created.
-
updated_at: a datetime field with "auto_now", so we track when the model was last updated.
The name comes from Django Reinhart father, Jean-Baptiste (or Jables, for short).
-
Install the package
django-jables
as any other requirement to your project. -
When creating models, inherit from
JBModel
:
from jables.models import JBModel
class MyModel(JBModel):
...