37769-vm/door_views_update.py
2026-02-04 22:19:54 +00:00

17 lines
553 B
Python

import sys
file_path = 'core/views.py'
with open(file_path, 'r') as f:
content = f.read()
old_code = 'visited_households[key]["voters_at_address"].add(f"{v.first_name} {v.last_name}")'
new_code = 'visited_households[key]["voters_at_address"].add((v.id, f"{v.first_name} {v.last_name}"))'
if old_code in content:
new_content = content.replace(old_code, new_code)
with open(file_path, 'w') as f:
f.write(new_content)
print("Successfully patched core/views.py")
else:
print("Could not find the target line in core/views.py")