From f1c75ed9c54855bbaa059c9454afe00f138b8eb7 Mon Sep 17 00:00:00 2001 From: "Lucas F." Date: Tue, 17 Dec 2024 10:32:20 -0300 Subject: [PATCH] update: create form file --- lua/django/utils.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/django/utils.lua b/lua/django/utils.lua index 916a01d..c5acac7 100644 --- a/lua/django/utils.lua +++ b/lua/django/utils.lua @@ -103,6 +103,14 @@ local function file_exists(name) end end +local function create_form_file(dir) + local file = io.open(helpers.add_trailing_slash(dir) .. "forms.py", "w") + if file ~= nil then + file:write("from django import forms") + io.close(file) + end +end + local function create_template_static_dirs(name, dir) execute_command(os.execute, "mkdir -p " .. dir .. "/static/" .. name .. "/css") execute_command(os.execute, "mkdir -p " .. dir .. "/static/" .. name .. "/img") @@ -135,6 +143,7 @@ local function perform_create_app(value) end execute_command(os.execute, "./manage.py startapp " .. appname .. " " .. value) if check_app(value) == true then + create_form_file(value) create_template_static_dirs(value, value) execute_command( os.execute,