ADD: dav_events: purging participants.
This commit is contained in:
13
dav_events/utils.py
Normal file
13
dav_events/utils.py
Normal 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()
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user