In my model I have status
class CustomUser(AbstractUser):
alias_email = models.EmailField(null=True, blank=True)
alias_name = models.CharField(max_length=20, unique=True, null=True, blank=True)
cell = models.CharField(blank=True, max_length=10, help_text='Cell phone number (numbers only)')
downline = models.CharField(tuple, max_length=1000000, default=1)
email_confirmed = models.BooleanField(default=False)
org_agreement_accept = models.BooleanField(default=False)
sponsor = models.BigIntegerField(default=1)
sponsor_accept = models.BooleanField(default=False, null=True, blank=True)
upline = models.CharField(tuple, max_length=1000000, default=1)
org = models.ForeignKey(Organization, on_delete=models.SET_NULL, null=True)
Status = (
(1, 'Fish'),
(2, 'FAS'),
(3, 'Fisher'),
(4, 'OSA'),
(5, 'Org Crew'),
(6, 'Org Admin'),
(7, 'Org Owner'),
)
status = models.SmallIntegerField(choices=Status, default=1)
class Meta:
ordering = ['alias_name', 'org', 'username', 'email', 'cell', 'sponsor', 'org_id', 'status']
def __str__(self):
return f'{self.alias_name}, {self.org}, {self.username}, {self.email}, {self.cell}, {self.sponsor}, {self.org}, {self.status}'
I use the numbers for queries but want to display the name.