Django管理 - jQuery命名空间 [英] Django admin - jQuery namespace

查看:167
本文介绍了Django管理 - jQuery命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Django管理员将jQuery命名空间设置为 django.jQuery (以避免冲突)



如果我没有默认的 $ 命名空间jQuery,插件不行吗?



我必须做一些像

 窗口$ = django.jQuery 



如何&在哪里可以更改整个管理员网站的这个命名空间?

解决方案

实际上,大多数插件都需要jQuery - 而不是$ - 可以使用,然后在dmidz的答案中提供$自己。



因此,插入

  var jQuery = django.jQuery; 

在您的外部引用之前。如果您正在加载一堆第三方jQuery插件,请将上述代码放入插件插件的脚本标签中。



五个月前另见我的问题如何提供$到第三方的外部jQuery Django管理员中的插件


I'm trying to use certain jQuery plugins in my Django admin site.

Django admin sets the jQuery namespace to django.jQuery (to avoid conflicts)

If I don't have the default $ namespace for jQuery, the plugins won't work, will they ?

Do I have to do something like

window.$ = django.jQuery

?

How & where can I change this namespace for the whole admin site ?

解决方案

Actually, most plugins will require "jQuery" - not $ - to be available, and then provide $ themselves as in dmidz's answer.

Therefore, insert

var jQuery = django.jQuery;

before your external references. If you're loading a bunch of thirdparty jQuery plugins, put the above line in a script tag that preceeds the plugins.

See also my question five months ago How to provide $ to third-party, external jQuery plugins in Django admin

这篇关于Django管理 - jQuery命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆