Skip to content
Advertisement

Is it better to use JsonField or multiple model fields for a Django Model?

For example,

JavaScript

Or

JavaScript

Assume that I have a limited (max 5) number of descriptions. Which approach is better and would be considered as good practice?

Advertisement

Answer

I am generally in favour of multiple models rather than using JSON, though there is still a time and a place for the JSON field. You have a number of description fields, you can do something like this:

JavaScript

You can then have any number of descriptions and access them like this:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement