-
Notifications
You must be signed in to change notification settings - Fork 90
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
ReferenceError: Can't find variable: JSONEditor #27
Comments
Same problem here... Googling |
As for now, I managed to fix it with this: from django_json_widget.widgets import JSONEditorWidget
class CustomJSONEditorWidget(JSONEditorWidget):
# hardcode media until this issue gets resolved
# https://github.com/jmrivas86/django-json-widget/issues/27
class Media:
extend = False
css = {
"all": (
"https://cdnjs.cloudflare.com/ajax/libs/"
"jsoneditor/7.0.4/jsoneditor.min.css",
"https://cdnjs.cloudflare.com/ajax/libs/"
"jsoneditor/7.0.4/img/jsoneditor-icons.svg",
)
}
js = ( # pylint: disable=invalid-name
"https://cdnjs.cloudflare.com/ajax/libs/"
"jsoneditor/7.0.4/jsoneditor.min.js",
) |
Using django-json-widget==1.0.1 I still get the issue ReferenceError: JSONEditor is not defined. I ofcourse added the app in INSTALLED_APPS and the widget to the form ala I had to add:
To the top of the form. Adding the django-json-widget to the admin interface does work without any adjustments. |
I did a collectstatic to get the files in the static folder of the project, if you are running the server from apache, or from anything else than a runserver, the files need to be in the static folder in order to be served.
|
Once I did a collectstatic the issue didn't fix itself, but I included a local copy of the files that were collected in the page iwth the JSONEditor, and this solves the problem for now. |
All I had to do was a |
Make sure |
Nice collect static, fixes it. That's not in the documentation , as far as I could tell. |
Added the app in INSTALLED_APPS
Added the widget in the form
If i refresh the admin page, i get
The text was updated successfully, but these errors were encountered: