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
# match that doesn't have class="modern-form" content = re.sub(r'