32đź‘Ť
âś…
That’s not a callable.
You have two options here:
- Rely on
dict
as a default; this will result in your models using an empty dict{}
if none is supplied:
class UnderwritingValidator(TimeStampedModel):
plan = models.PositiveIntegerField(null=True, blank=True, unique=True)
logic = JSONField(default=dict)
- Create your own “callable” and use it as default:
def get_default_something():
return {'accept_list': [], 'reject_list': []}
class UnderwritingValidator(TimeStampedModel):
plan = models.PositiveIntegerField(null=True, blank=True, unique=True)
logic = JSONField(default=get_default_something)
👤Alex
Source:stackexchange.com