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
+12
View File
@@ -0,0 +1,12 @@
import re
with open('templates/expenses/expense_form.html', 'r', encoding='utf-8') as f:
content = f.read()
# 1. Add x-data to the form
content = content.replace('<form method="post" enctype="multipart/form-data">', '<form method="post" enctype="multipart/form-data" x-data="expenseForm()">')
# 2. Add x-model to is_reimbursement and x-show to responsible person
# Search for {{ form.is_reimbursement }}
content = content.replace('{{ form.is_reimbursement }}', '{{ form.is_reimbursement }}')
# Wait, I can just inject AlpineJS attributes using django-widget-tweaks or by replacing the input html, but since it's rendered via {{ form.xxx }}, I need to modify `forms.py` to add `x-model` or wrap them in Alpine elements.