import sys
with open('core/templates/core/voter_detail.html', 'r') as f:
content = f.read()
old_thead = '''
| Date |
Event Type |
Status |
Description |
Actions |
'''
new_thead = '''
| Date |
Event Name |
Event Type |
Status |
Description |
Actions |
'''
if old_thead in content:
content = content.replace(old_thead, new_thead)
else:
print("Warning: old_thead not found")
old_tbody = ''' {% for participation in event_participations %}
| {{ participation.event.date|date:"M d, Y" }} |
{{ participation.event.event_type.name }} | '''
new_tbody = ''' {% for participation in event_participations %}
| {{ participation.event.date|date:"M d, Y" }} |
{{ participation.event.name|default:"(No Name)" }} |
{{ participation.event.event_type.name }} | '''
if old_tbody in content:
content = content.replace(old_tbody, new_tbody)
else:
print("Warning: old_tbody not found")
with open('core/templates/core/voter_detail.html', 'w') as f:
f.write(content)