first commit

This commit is contained in:
Joren de Graaf
2026-10-04 17:09:22 +02:00
commit 1d4407462a
140 changed files with 7893 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
from django.db import transaction
from django.utils import timezone
from events.models import Event
@transaction.atomic
def review(event,reviewer,approve,reason=''):
if event.status!=Event.Status.PENDING: return event
event.status=Event.Status.APPROVED if approve else Event.Status.REJECTED
event.reviewed_at=timezone.now();event.reviewed_by=reviewer;event.rejection_reason=reason
if not approve and event.audio_file:
file=event.audio_file;event.audio_file='';event.save();transaction.on_commit(file.delete)
else: event.save()
return event