import os file_path = 'core/templates/core/volunteer_list.html' with open(file_path, 'r') as f: content = f.read() old_code = """ const smsModal = document.getElementById('smsModal'); if (smsModal) { smsModal.addEventListener('show.bs.modal', function () { const container = document.getElementById('selected-volunteers-container'); container.innerHTML = ''; checkboxes.forEach(cb => { if (cb.checked) { const input = document.createElement('input'); input.type = 'hidden'; input.name = 'selected_volunteers'; input.value = cb.value; container.appendChild(input); } }); }); }""" new_code = """ const smsModal = document.getElementById('smsModal'); if (smsModal) { smsModal.addEventListener('show.bs.modal', function () { const container = document.getElementById('selected-volunteers-container'); container.innerHTML = ''; checkboxes.forEach(cb => { if (cb.checked) { const input = document.createElement('input'); input.type = 'hidden'; input.name = 'selected_volunteers'; input.value = cb.value; container.appendChild(input); } }); }); } const emailModal = document.getElementById('emailModal'); if (emailModal) { emailModal.addEventListener('show.bs.modal', function () { const container = document.getElementById('selected-volunteers-email-container'); container.innerHTML = ''; checkboxes.forEach(cb => { if (cb.checked) { const input = document.createElement('input'); input.type = 'hidden'; input.name = 'selected_volunteers'; input.value = cb.value; container.appendChild(input); } }); }); }""" 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/templates/core/volunteer_list.html") else: print("Could not find the code block to patch in core/templates/core/volunteer_list.html")