When I migrate or run the testserver, I get this following complaint.
System check identified some issues:
contentmanager.ContentElement.text: (fields.E010) JSONField default should be a callable instead of an instance so that it’s not shared between all field instances.
HINT: Use a callable instead, e.g., use
Here’s the referenced field:
text = JSONField(default=dict(settings.MULTITEXT_CHOICES))
And here’s settings.MULTITEXT_CHOICES:
# (*Language*, _('*Display Name*')), (MULTITEXT_LANGUAGES['ENGLISH'], 'English'), (MULTITEXT_LANGUAGES['GERMAN'], 'German'), ]
So from my understanding, dict() is a callable. However I’m using it on a list of lists. So, does that mean, that I’m creating an independent instance of dict which points to the same values, as the list of lists? Is that why I get the complaint?
The values in the settings.py don’t ever change during runtime which makes me think, that I can ignore the warning.