handle json field empty value case
This commit is contained in:
parent
155cfb44e8
commit
954813d359
1 changed files with 1 additions and 1 deletions
|
@ -15,7 +15,7 @@ class KeyValueInput(forms.Widget):
|
|||
def get_context(self, name, value, attrs):
|
||||
context = super().get_context(name, value, attrs)
|
||||
data = json.loads(context['widget']['value'])
|
||||
context['widget']['value'] = [ {p[0]: p[1]} for p in data.items()]
|
||||
context['widget']['value'] = [ {p[0]: p[1]} for p in data.items()] if data else []
|
||||
return context
|
||||
|
||||
class Media:
|
||||
|
|
Loading…
Add table
Reference in a new issue