mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Default JSONField to empty dict if field does not allow None.
This commit is contained in:
parent
8dc5e7725c
commit
3eb6f55a80
@ -33,6 +33,8 @@ __all__ = ['AutoOneToOneField', 'ImplicitRoleField', 'JSONField']
|
||||
class JSONField(upstream_JSONField):
|
||||
|
||||
def from_db_value(self, value, expression, connection, context):
|
||||
if value in {'', None} and not self.null:
|
||||
return {}
|
||||
return super(JSONField, self).from_db_value(value, expression, connection, context)
|
||||
|
||||
# Based on AutoOneToOneField from django-annoying:
|
||||
|
Loading…
Reference in New Issue
Block a user