I am working with data that I get from an external source. One field is not easily converted to something user readable. The data I get from the API is “encoded”. It returns as ##user00, ##user01, ##user02 etc.
But there is an API endpoint that returns the translation table. This table may change or at least be updated.
Can I get the CharField with Choices behavior but not enforce the data validation and update the choices without a migration?
Category field below is stored as ##user00, ##user01 , ##user02 etc but I want it to be showed to the user as something else.
Thank you, but I can only find ModelChoiceField as part of a form. Not as a model field. I primarily want this for displaying data. In the Model field reference I can only find Choices as part of other fields.
You would also be able to use that table for any purpose. You would not be restricted to using that model only for the ModelChoiceField. It becomes a general translation table that you can use anywhere.
What I am thinking now, to get filters to work and data display to show a friendly name, is that I create a new model with the translation. Have a one-to-many field in the Product model that I connect to the new model to get filters etc to hopefully work kind of out of the box.
If I would need to push info about the product back to the API it would make it a bit trickier but at the moment it is one way.