Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widget doesn't work with boolean values #90

Open
h4nz11 opened this issue Jul 13, 2024 · 2 comments
Open

Widget doesn't work with boolean values #90

h4nz11 opened this issue Jul 13, 2024 · 2 comments

Comments

@h4nz11
Copy link

h4nz11 commented Jul 13, 2024

  • 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 h4nz11 changed the title Widget doesn't work with boolean values. Widget doesn't work with boolean values Jul 13, 2024
@paulocoutinhox
Copy link

Hi,

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

Thanks.

@h4nz11
Copy link
Author

h4nz11 commented Sep 21, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants