Skip to content

Commit

Permalink
Fix anonymous user access error
Browse files Browse the repository at this point in the history
  • Loading branch information
cmutel committed Jan 13, 2025
1 parent 4245853 commit 08c592d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dds_registration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def can_register(self, user):
if self.max_participants and self.active_registration_count >= self.max_participants:
return False
if self.application_form:
if Registration.objects.filter(user=user, event__id=self.id, status="SELECTED").count():
if user.is_authenticated() and Registration.objects.filter(user=user, event__id=self.id, status="SELECTED").count():
return self.today_within_registration_band()
return self.today_within_application_band()
return self.today_within_registration_band()
Expand All @@ -541,7 +541,7 @@ def active_registration_count(self):
return self.registrations.filter(REGISTRATION_ACTIVE_QUERY).count()

def get_active_event_registration_for_user(self, user: User):
if not user.is_anonymous:
if user.is_authenticated():
active_user_registrations = list(self.registrations.all().filter(REGISTRATION_ACTIVE_QUERY, user=user))
else:
active_user_registrations = []
Expand Down

0 comments on commit 08c592d

Please sign in to comment.