1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 09:58:23 +02:00

Guests can't be invited since the activity is started

This commit is contained in:
Yohann D'ANELLO
2020-03-30 17:27:02 +02:00
parent fb5796d35e
commit fcb4da2db3
5 changed files with 26 additions and 46 deletions

View File

@ -1,6 +1,6 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from datetime import timedelta
from datetime import timedelta, datetime
from django import forms
from django.contrib.contenttypes.models import ContentType
@ -41,6 +41,9 @@ class GuestForm(forms.ModelForm):
def clean(self):
cleaned_data = super().clean()
if self.activity.date_start > datetime.now():
self.add_error("inviter", _("You can't invite someone once the activity is started."))
one_year = timedelta(days=365)
qs = Guest.objects.filter(