There are some things in Django I constantly forget!
Getting the friendly value for a enum value
You have model:
class MyModel(models.Model)
thing = models.IntegerField(choices=SOME_CHOICES)
You want the value for thing:
happy_value = my_instance.get_thing_valuedisplay()
or
python -m pip install jupyter
then
python manage.py shell_plus --notebook
thing = models.IntegerField(choices=SOME_CHOICES)
You want the value for thing:
happy_value = my_instance.get_thing_
Use the free jupyter shell that comes with django extensions
pip3 install jupyteror
python -m pip install jupyter
then
python manage.py shell_plus --notebook