From b7385a3c68789d3b77eb4a03868c9185fd1d4e8e Mon Sep 17 00:00:00 2001 From: Dominic DiTaranto Date: Sun, 17 Nov 2024 17:15:18 -0500 Subject: auto handle events --- scripts/bp_deactivate.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 scripts/bp_deactivate.py (limited to 'scripts/bp_deactivate.py') diff --git a/scripts/bp_deactivate.py b/scripts/bp_deactivate.py new file mode 100644 index 0000000..1a125d5 --- /dev/null +++ b/scripts/bp_deactivate.py @@ -0,0 +1,15 @@ +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() + -- cgit v1.2.3-70-g09d2