Django textChoices are of the following format:
The choices are on the following format:
The db_format is what's saved to the DB.
The display_format is what's displayed when you call get_
You basically choose which to save in the DB, the integer or the text choice. The problem is when your model is serialized, if you have field year with choices of YearInSchool(models.IntegerChoices):, you'll have this:
"year": 1
in your JSON, but you expect it to show "Freshman", Of course you can manipulate this on the serializer level to show freshman if the year is 1.
IntegerChoices are much faster when they are looked up, but the are too ambiguous. If I were you, I'd use IntegerChoices every single time and manipulate the response through the serializer to show the text instead of the integer itself.