How to use Django Field Choices

SUPPORT_CHOICES=(
    (“create”,”create”),
    (“update”,”update”),
    (“resolved”, “resolved”),
    (“unsolved”,”unsolved”)
)

class Support(models.Model):
    support_type = models.CharField(max_length=10, choices=SUPPORT_CHOICES, default=’create’)

    def __str__(self):
        return self.support_type

LEAVE A REPLY

Please enter your comment!
Please enter your name here