ADD: dav_events: purging participants.

This commit is contained in:
2019-06-05 12:10:31 +02:00
parent abb013cadc
commit 7a16bee457
2 changed files with 19 additions and 0 deletions

13
dav_events/utils.py Normal file
View File

@@ -0,0 +1,13 @@
import logging
from django.utils import timezone
from .models import Participant
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()

View File

@@ -1,5 +1,11 @@
from django.views import generic
from ..utils import purge_participants
class HomeView(generic.TemplateView):
template_name = 'dav_events/home.html'
def get(self, request, *args, **kwargs):
purge_participants()
return super(HomeView, self).get(request, *args, **kwargs)