diff --git a/cookbook/forms.py b/cookbook/forms.py index 37a3263834..e47acac0da 100644 --- a/cookbook/forms.py +++ b/cookbook/forms.py @@ -1,3 +1,5 @@ +from datetime import datetime + from django import forms from django.conf import settings from django.core.exceptions import ValidationError @@ -350,7 +352,7 @@ def __init__(self, *args, **kwargs): def clean(self): space = self.cleaned_data['space'] if space.max_users != 0 and (UserPreference.objects.filter(space=space).count() + InviteLink.objects.filter( - space=space).count()) >= space.max_users: + space=space).filter(valid_until__gte=datetime.today()).count()) >= space.max_users: raise ValidationError(_('Maximum number of users for this space reached.')) def clean_email(self):