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('
', '') # 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.