summaryrefslogtreecommitdiff
path: root/scripts/bp_deactivate.py
diff options
context:
space:
mode:
authorDominic DiTaranto <domdit@gmail.com>2024-11-17 17:15:18 -0500
committerDominic DiTaranto <domdit@gmail.com>2024-11-17 17:15:18 -0500
commitb7385a3c68789d3b77eb4a03868c9185fd1d4e8e (patch)
tree498f9664ff2f77922631794b22b46a3a0a66f516 /scripts/bp_deactivate.py
parentc76633eb69cc31d7d1827dd6fd1b1bcb2a3f1c4b (diff)
auto handle events
Diffstat (limited to 'scripts/bp_deactivate.py')
-rw-r--r--scripts/bp_deactivate.py15
1 files changed, 15 insertions, 0 deletions
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()
+