from django.db import models from django.contrib.auth.models import AbstractUser from . import club, enums import uuid class CustomUser(AbstractUser): pass id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True) umpire_code = models.CharField(max_length=50, blank=True, null=True) clubs = models.ManyToManyField(club.Club, blank=True) phone = models.CharField(max_length=15, null=True, blank=True) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) licence_id = models.CharField(max_length=10, null=True, blank=True) country = models.CharField(max_length=40, null=True, blank=True) #taille infini? call_message_body = models.TextField(blank=True, null=True) call_message_signature = models.TextField(blank=True, null=True) call_display_format = models.BooleanField(default=False) call_display_entry_fee = models.BooleanField(default=False) call_use_full_custom_message = models.BooleanField(default=False) match_formats_default_duration = models.JSONField(blank=True, null=True) bracket_match_format_preference = models.IntegerField(default=enums.FederalMatchCategory.NINE_GAMES, choices=enums.FederalMatchCategory.choices, null=True, blank=True) group_stage_match_format_preference = models.IntegerField(default=enums.FederalMatchCategory.NINE_GAMES, choices=enums.FederalMatchCategory.choices, null=True, blank=True) loser_bracket_match_format_preference = models.IntegerField(default=enums.FederalMatchCategory.NINE_GAMES, choices=enums.FederalMatchCategory.choices, null=True, blank=True) def fields_for_update(): # returns the list of fields to update without password return ['id', 'username', 'email', 'umpire_code', 'clubs', 'phone', 'first_name', 'last_name', 'licence_id', 'country', 'call_message_body', 'call_message_signature', 'call_display_format', 'call_display_entry_fee', 'call_use_full_custom_message', 'match_formats_default_duration', 'bracket_match_format_preference', 'group_stage_match_format_preference', 'loser_bracket_match_format_preference'] def __str__(self): return self.username