1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-27 20:22:15 +02:00

[activity] comments on view and forms

This commit is contained in:
Pierre-antoine Comby
2020-08-19 11:31:15 +02:00
parent b0ebc7c0a4
commit 00935a8c02
2 changed files with 57 additions and 13 deletions

View File

@ -41,6 +41,15 @@ class ActivityForm(forms.ModelForm):
class GuestForm(forms.ModelForm):
def clean(self):
"""
Someone can be invited as a Guest to an Activity if:
- the activity has not already started.
- the activity is validated.
- the Guest has not already been invited more than 5 times.
- the Guest is already invited.
- the inviter already invited 3 peoples.
"""
cleaned_data = super().clean()
if timezone.now() > timezone.localtime(self.activity.date_start):