[英]How can i fix the error Uncaught ReferenceError: addEvent is not defined
After changing my python and Django version I came up with the error of更改我的 python 和 Django 版本后,我想出了错误
Uncaught ReferenceError: addEvent is not defined
. Uncaught ReferenceError: addEvent is not defined
。
The error took place at my DateTimeShortcuts.js
file.错误发生在我的
DateTimeShortcuts.js
文件中。
The code raising the error is:引发错误的代码是:
addEvent(window, 'load', DateTimeShortcuts.init);
window.DateTimeShortcuts = DateTimeShortcuts;
This error prevents me for rendering correct a date widget that I am using for my Django app.此错误阻止我正确渲染我用于 Django 应用程序的日期小部件。
Any idea how to handle it?知道如何处理吗?
From commit into Django framework " Fixed #28536 -- Removed old JS cross-browser utilities " you can see that there were changes in that file.从提交到 Django 框架“ Fixed #28536 -- Removed old JS cross-browser utility ”,您可以看到该文件中有更改。
Try to run command that will refresh all static files:尝试运行将刷新所有静态文件的命令:
python manage.py collectstatic
The problem is ' addEvent ' is not defined previously.问题是先前未定义“ addEvent ”。
Make sure that you have the definition of ' addEvent ' imported or written before this line.确保在此行之前导入或写入了“ addEvent ”的定义。
也许你应该写
window.addEventListener("load", ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.