Ensure no-responses and sign-offs are character-agnostic, in addition to already being role-agnostic.

This commit is contained in:
Casper V. Kristensen 2020-05-28 04:30:27 +02:00
parent 502698a501
commit 027fbb4ab3
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -114,8 +114,9 @@ class RaidResponse(models.Model):
self._original_status = self.status
def clean(self):
# Make sure no-responses and sign-offs are role-agnostic, but all other responses are not
# Make sure no-responses and sign-offs are character- and role-agnostic, but all other responses are not
if self.status <= RaidResponse.Status.SIGNED_OFF:
self.character = self.character.user.main
self.role = None
elif self.role is None:
raise ValidationError({"role": "This field is required."})