37769-vm/core_admin_patch.py
Flatlogic Bot d8bf0cd82c 2.0
2026-01-29 18:46:31 +00:00

33 lines
1.8 KiB
Python

import sys
with open('core/admin.py', 'r') as f:
content = f.read()
old_block = """ defaults = {}
if participation_status_val and participation_status_val.strip():
defaults = {}
if participation_status_val and participation_status_val.strip():
status_obj, _ = ParticipationStatus.objects.get_or_create(tenant=tenant, name=participation_status_val.strip())
defaults['participation_status'] = status_obj
else:
# Default to 'Invited' if not specified
status_obj, _ = ParticipationStatus.objects.get_or_create(tenant=tenant, name='Invited')
defaults['participation_status'] = status_obj"""
new_block = """ defaults = {}
if participation_status_val and participation_status_val.strip():
status_obj, _ = ParticipationStatus.objects.get_or_create(tenant=tenant, name=participation_status_val.strip())
defaults['participation_status'] = status_obj
else:
# Default to 'Invited' if not specified
status_obj, _ = ParticipationStatus.objects.get_or_create(tenant=tenant, name='Invited')
defaults['participation_status'] = status_obj"""
if old_block in content:
new_content = content.replace(old_block, new_block)
with open('core/admin.py', 'w') as f:
f.write(new_content)
print("Patch applied successfully")
else:
print("Old block not found")