def __init__(self, row): self.receive_emails = True if bytearray(row[EMIAL_OPT_COL]).decode('utf-8') == 'Receive all e-mails' else False self.first_name = bytearray(row[FIRST_NAME_COL]).decode('utf-8') self.last_name = bytearray(row[LAST_NAME_COL]).decode('utf-8') self.email = bytearray(row[EMAIL_COL]).decode('utf-8') self.shirt_number = bytearray(row[SHIR_NUMBER_COL]).decode('utf-8').lstrip('[').rstrip(']') if is_none_or_empty(self.shirt_number): self.shirt_number = None
def clean(self): if self.comment_type == MatchComment.COMMENT_TYPE.Update and is_none_or_empty(self.comment): raise ValidationError("A comment must be supplied for an 'update' match comment")