iteracion 2

This commit is contained in:
Nachou-u
2026-09-07 18:44:32 -03:00
parent a103a47ae6
commit 09a3f6fb37
93 changed files with 7394 additions and 349 deletions
+23
View File
@@ -0,0 +1,23 @@
import os
import re
def process_file(filepath):
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
if '{{ form.as_p }}' in content:
# replace {{ form.as_p }} with {% include 'partials/_form_grid.html' %}
content = content.replace('{{ form.as_p }}', '{% include "partials/_form_grid.html" %}')
# also try to add modern-form class to <form>
# match <form ...> that doesn't have class="modern-form"
content = re.sub(r'<form\s+method="post"(?!.*?class="modern-form")', r'<form method="post" class="modern-form"', content)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"Updated {filepath}")
for root, dirs, files in os.walk('templates'):
for file in files:
if file.endswith('.html') and file != '_form_grid.html':
process_file(os.path.join(root, file))