Skip to content

Commit

Permalink
fixed valid filter on invite link counter
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Jan 17, 2022
1 parent 13115a1 commit 745bb58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion 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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 745bb58

Please sign in to comment.