From 7bac6b176e3b29258fc2f896fcb1bdca3a1f69fd Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Thu, 28 May 2026 10:34:05 +0545 Subject: [PATCH] fix(src/djinit/creators): add project_name to urls_context and urls.py template context - Ensure project_name is passed when generating urls.py, preventing TemplateError. - Improves template rendering consistency for API route inclusion. --- src/djinit/creators/files.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/djinit/creators/files.py b/src/djinit/creators/files.py index 5294622..a3abc22 100644 --- a/src/djinit/creators/files.py +++ b/src/djinit/creators/files.py @@ -117,7 +117,12 @@ class FileCreator(BaseService): ) -> None: """Helper to create urls.py, wsgi.py, and asgi.py.""" - urls_context = {"url_type": "project", "api_module": api_module, "include_api": True} + urls_context = { + "url_type": "project", + "project_name": self.project_name, + "api_module": api_module, + "include_api": True, + } if comment_out_api: urls_context["comment_out_api_url"] = True @@ -303,7 +308,7 @@ class FileCreator(BaseService): CommonUtils.create_file_from_template( project_urls_path, "config/urls.py-tpl", - {"url_type": "project", "api_module": "api", "include_api": True}, + {"url_type": "project", "project_name": self.project_name, "api_module": "api", "include_api": True}, "Updated project urls.py to include API routes", should_format=True, )