Answer the question
In order to leave comments, you need to log in
How to add dynamic attributes to a Django model?
Question like this - Django - what is the best way to bind multiple elements to the model (it is not known how many)?
But I would like to be able to set the data type of the field - number, string, time.
What is the best way to do this? Add a field with a data type (so that there is a select in the admin panel) + write custom validation depending on the data type and store everything in a CharField.
Or are there better ways? How well will Django-eav fit here and what are the pitfalls when working with it?
Answer the question
In order to leave comments, you need to log in
EAV is the only way this can be implemented. The pitfall is that EAV is always a sign that a relational database is being misused. Plus, it's damn slow.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question