From 018d71e999c9a632e084ee228955eb739e51cfef Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 15 Sep 2026 08:24:40 +0545 Subject: [PATCH] feat: add TimeStampedModel base.py-tpl to project initialization --- src/djinit/templates/components/base.py-tpl | 11 +++++++++++ src/djinit/utils/django.py | 1 + 2 files changed, 12 insertions(+) create mode 100644 src/djinit/templates/components/base.py-tpl diff --git a/src/djinit/templates/components/base.py-tpl b/src/djinit/templates/components/base.py-tpl new file mode 100644 index 0000000..5108722 --- /dev/null +++ b/src/djinit/templates/components/base.py-tpl @@ -0,0 +1,11 @@ +"""generated with djinit""" + +from django.db import models + + +class TimeStampedModel(models.Model): + created_at = models.DateTimeField(auto_now_add=True) + updated_at = models.DateTimeField(auto_now=True) + + class Meta: + abstract = True diff --git a/src/djinit/utils/django.py b/src/djinit/utils/django.py index 2402e22..66e5ea7 100644 --- a/src/djinit/utils/django.py +++ b/src/djinit/utils/django.py @@ -71,6 +71,7 @@ class DjangoHelper: ("urls.py", "config/urls.py-tpl", urls_context), ("wsgi.py", "config/wsgi.py-tpl", {"project_name": project_name}), ("asgi.py", "config/asgi.py-tpl", {"project_name": project_name}), + ("base.py", "components/base.py-tpl", {}), ] CommonUtils.create_files_from_templates(project_config_dir, project_files, f"{project_name}/")