import sys file_path = 'core/templates/core/yard_sign_voters.html' with open(file_path, 'r') as f: content = f.read() header_old = 'Voters Wanting Sign' header_new = header_old + '\n Sign Type' content = content.replace(header_old, header_new) cell_old = '\n {% endfor %}\n \n ' cell_new = cell_old + '\n \n \n {{ household.sign_types_display }}\n \n ' content = content.replace(cell_old, cell_new) icon_old = "icon: 'http://maps.google.com/mapfiles/ms/icons/red-dot.png'" icon_new = "icon: item.is_large ? 'http://maps.google.com/mapfiles/ms/icons/orange-dot.png' : 'http://maps.google.com/mapfiles/ms/icons/red-dot.png'" content = content.replace(icon_old, icon_new) info_old = "votersCount.textContent = 'Voters: ' + item.voters;" info_new = info_old + "\n \n var typeDiv = document.createElement('div');\n typeDiv.className = 'mb-2 small fw-bold';\n typeDiv.textContent = 'Type: ' + (item.is_large ? 'Large Sign' : 'Yard Sign');\n container.appendChild(typeDiv);" content = content.replace(info_old, info_new) with open(file_path, 'w') as f: f.write(content)