korabo/scripts/bp_deactivate.py
2024-11-17 17:15:18 -05:00

16 lines
341 B
Python

from django.utils import timezone
from web.models import Event
def deactivate():
today = timezone.now()
active_events = Event.objects.filter(active=True).all()
for event in active_events:
if 'BP' in event.name:
if event.end_date < today:
event.active = False
event.save()