本文整理汇总了Python中django.forms.Media.add_css方法的典型用法代码示例。如果您正苦于以下问题:Python Media.add_css方法的具体用法?Python Media.add_css怎么用?Python Media.add_css使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.forms.Media
的用法示例。
在下文中一共展示了Media.add_css方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from django.forms import Media [as 别名]
# 或者: from django.forms.Media import add_css [as 别名]
def __init__(self, **kwargs):
self._css = {}
self._js = []
if kwargs:
Media.add_css(self, kwargs.get('css', None))
Media.add_js(self, kwargs.get('js', None))
示例2: _upgrade_jquery
# 需要导入模块: from django.forms import Media [as 别名]
# 或者: from django.forms.Media import add_css [as 别名]
def _upgrade_jquery(self, media):
# upgrade jquery and cms jquery UI
new_media = Media()
new_media.add_css(media._css)
new_jquery_version = static('cms_blogger/js/jquery-1.9.1.min.js')
new_jquery_ui_version = static('cms_blogger/js/jquery-ui.min.js')
# make sure all jquery namespaces point to the same jquery
jquery_namspace = static('cms_blogger/js/jQuery-patch.js')
django_jquery_urls = [static('admin/js/jquery.js'),
static('admin/js/jquery.min.js')]
django_collapse_js = [static('admin/js/collapse.js'),
static('admin/js/collapse.min.js')]
for js in media._js:
if js in django_jquery_urls:
new_media.add_js((new_jquery_version, ))
elif js in django_collapse_js:
new_media.add_js(
(static('cms_blogger/js/admin-collapse.js'), ))
elif js == static('admin/js/jquery.init.js'):
new_media.add_js((js, jquery_namspace))
elif js.startswith(static('cms/js/libs/jquery.ui.')):
new_media.add_js((new_jquery_ui_version, ))
else:
new_media.add_js((js, ))
return new_media
示例3: vendor
# 需要导入模块: from django.forms import Media [as 别名]
# 或者: from django.forms.Media import add_css [as 别名]
def vendor(*tags):
media = Media()
for tag in tags:
file_type = tag.split('.')[-1]
files = xstatic(tag)
if file_type == 'js':
media.add_js(files)
elif file_type == 'css':
media.add_css({'screen': files})
return media
示例4: _media
# 需要导入模块: from django.forms import Media [as 别名]
# 或者: from django.forms.Media import add_css [as 别名]
def _media(self):
base = getattr(super(AdminCropdusterWidget, self), 'media', None)
media = Media(base) if base else Media()
media_url = reverse("cropduster-static", kwargs={"path": ""})
media.add_js([media_url + 'js/admin.cropduster.js',])
media.add_css({
'all': (
media_url + 'css/admin.cropduster.css',
),})
return media