django-json-widget icon indicating copy to clipboard operation
django-json-widget copied to clipboard

Widget doesn't work with boolean values

Open h4nz11 opened this issue 1 year ago • 2 comments

  • django-json-widget version:
  • Django version: 5.0.2
  • Python version: 3.10
  • Operating System: Ubuntu

Description

The widget doesn't display data if the JSONField contains a boolean value. It throws a javascript exception:

Uncaught ReferenceError: True is not defined
    at change/:982:186
    at change/:984:7

Loaded data in HTML:

var json = {'label': 'Metered consumption - house', 'category': 'consumption', 'convertToNegative': True};

h4nz11 avatar Jul 13 '24 06:07 h4nz11

Hi,

The value "true" in JSON need be lower case "true" and not "True".

Thanks.

paulocoutinhox avatar Sep 21 '24 06:09 paulocoutinhox

Hi,

The value "true" in JSON need be lower case "true" and not "True".

Thanks.

Yeah, I've tried to save it with true but widget convert it back to "Python" syntax True.

h4nz11 avatar Sep 21 '24 09:09 h4nz11