25 lines
816 B
Python
25 lines
816 B
Python
import sys
|
|
|
|
file_path = 'core/forms.py'
|
|
with open(file_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Replace wants_yard_sign checkbox with wants_yard_sign_status ChoiceField in DoorVisitLogForm
|
|
old_field = """ wants_yard_sign = forms.BooleanField(
|
|
required=False,
|
|
widget=forms.CheckboxInput(attrs={"class": "form-check-input"}),
|
|
label="Wants a Yard Sign"
|
|
)"""
|
|
|
|
new_field = """ yard_sign_status = forms.ChoiceField(
|
|
choices=[('no_change', 'No Change'), ('none', 'No Sign'), ('wants', 'Wants Yard Sign'), ('wants_large', 'Wants Large Sign')],
|
|
initial='no_change',
|
|
widget=forms.Select(attrs={"class": "form-select"}),
|
|
label="Yard Sign Status"
|
|
)"""
|
|
|
|
content = content.replace(old_field, new_field)
|
|
|
|
with open(file_path, 'w') as f:
|
|
f.write(content)
|