Files
django-dav-events/dav_events/utils.py
heinzel 94595f4785
All checks were successful
buildbot/tox Build done.
Add a kind of trashbin for registrations and participants
2020-12-03 11:47:41 +01:00

17 lines
471 B
Python

import logging
from django.utils import timezone
from .models import Participant, TrashedParticipant
logger = logging.getLogger(__name__)
def purge_participants():
now = timezone.now()
for p in Participant.objects.filter(purge_at__lte=now):
logger.info('Purge participant \'%s\'', p)
p.delete()
for p in TrashedParticipant.objects.filter(purge_at__lte=now):
logger.info('Purge participant from trash \'%s\'', p)
p.delete()