1👍
✅
The proper way is to use the choices
argument for a particular field. Documentation here
Thus:
class AnObject(models.Models)
SHAPE_CHOICES = (
(CIRCLE, 'Circle'),
(TRIANGLE, 'Triangle'),
(SQUARE, 'Square'),
)
shape = models.CharField(max_length=8,
choices=SHAPE_CHOICES,
default=CIRCLE)
👤Alex
Source:stackexchange.com