in my model defn i have
from django.contrib.postgres.fields import JSONField
.....
.......
.........
media_data=JSONField(default=dict)
I crea
This caused problems for me recently, though with django-mysql
rather than postgres and in a custom ModelForm
rather than the admin interface.
I ended up overriding my model's save()
method:
from django_mysql.models import JSONField
class yourModel(model):
media_data=JSONField(default=dict, blank=True)
def clean(self, *args, **kwargs):
if self.media_data is None:
self.media_data = "{}"
def save(self, *args, **kwargs):
self.clean()
super().save(*args, **kwargs)