explicitely convert is_accepted to boolean
All checks were successful
Tests / test (push) Successful in 31s

The is_accepted property returns self.accepted_by or self.accepted_at.
When accepted_by is a User object (not None), it returns the User object
instead of a boolean.

The Django admin's boolean field renderer expects a boolean value
(True, False, or None), not a User object.
This commit is contained in:
Tobias Brunner 2025-10-17 10:40:00 +02:00
parent 014e88aa24
commit 54998ab9d0
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ

View file

@ -485,7 +485,7 @@ class OrganizationInvitation(ServalaModelMixin, models.Model):
def is_accepted(self):
# We check both accepted_by and accepted_at to avoid a deleted user
# freeing up an invitation
return self.accepted_by or self.accepted_at
return bool(self.accepted_by or self.accepted_at)
@property
def can_be_accepted(self):