本文整理匯總了Python中django.forms.Media方法的典型用法代碼示例。如果您正苦於以下問題:Python forms.Media方法的具體用法?Python forms.Media怎麽用?Python forms.Media使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.forms
的用法示例。
在下文中一共展示了forms.Media方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
css = {
'all': [
'django_admin_json_editor/fontawesome/css/font-awesome.min.css',
'django_admin_json_editor/style.css',
]
}
js = [
'django_admin_json_editor/jsoneditor/jsoneditor.min.js',
]
if self._editor_options['theme'] == 'bootstrap4':
css['all'].append('django_admin_json_editor/bootstrap/css/bootstrap.min.css')
js.append('django_admin_json_editor/jquery/jquery-3.5.1.slim.min.js')
js.append('django_admin_json_editor/bootstrap/js/bootstrap.bundle.min.js')
if self._sceditor:
css['all'].append('django_admin_json_editor/sceditor/themes/default.min.css')
js.append('django_admin_json_editor/sceditor/jquery.sceditor.bbcode.min.js')
return forms.Media(css=css, js=js)
示例2: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
extra = '' if settings.DEBUG else '.min'
i18n_name = SELECT2_TRANSLATIONS.get(get_language())
i18n_file = ('admin/js/vendor/select2/i18n/%s.js' % i18n_name,) if i18n_name else ()
return forms.Media(
js=(
'admin/js/vendor/jquery/jquery%s.js' % extra,
'admin/js/vendor/select2/select2.full%s.js' % extra,
) + i18n_file + (
'admin/js/jquery.init.js',
'admin/js/autocomplete.js',
),
css={
'screen': (
'admin/css/vendor/select2/select2%s.css' % extra,
'admin/css/autocomplete.css',
),
},
)
示例3: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
"""
Construct Media as a dynamic property.
.. Note:: For more information visit
https://docs.djangoproject.com/en/stable/topics/forms/media/#media-as-a-dynamic-property
"""
lang = get_language()
select2_js = (settings.SELECT2_JS,) if settings.SELECT2_JS else ()
select2_css = (settings.SELECT2_CSS,) if settings.SELECT2_CSS else ()
i18n_name = SELECT2_TRANSLATIONS.get(lang)
if i18n_name not in settings.SELECT2_I18N_AVAILABLE_LANGUAGES:
i18n_name = None
i18n_file = (
('%s/%s.js' % (settings.SELECT2_I18N_PATH, i18n_name),)
if i18n_name
else ()
)
return forms.Media(
js=select2_js + i18n_file + (static("js/django_select2.js"), ),
css={'screen': select2_css}
)
示例4: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
return forms.Media()
示例5: get_media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def get_media(self):
return forms.Media()
示例6: vendor
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [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
示例7: _get_media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def _get_media(self):
"""
Construct Media as a dynamic property.
.. Note:: For more information visit
https://docs.djangoproject.com/en/1.8/topics/forms/media/#media-as-a-dynamic-property
"""
return forms.Media(
js=(settings.SELECT2_JS, 'django_select2/django_select2.js'),
css={'screen': (settings.SELECT2_CSS,)}
)
示例8: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
js = ["core.js", "SelectBox.js", "SelectFilter2.js"]
return forms.Media(js=[static("admin/js/%s" % path) for path in js])
示例9: _media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def _media(self):
if 'collapse' in self.classes:
extra = '' if settings.DEBUG else '.min'
js = ['jquery%s.js' % extra,
'jquery.init.js',
'collapse%s.js' % extra]
return forms.Media(js=[static('admin/js/%s' % url) for url in js])
return forms.Media()
示例10: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
extra = '' if settings.DEBUG else '.min'
js = ['jquery%s.js' % extra, 'jquery.init.js', 'inlines%s.js' % extra]
if self.prepopulated_fields:
js.extend(['urlify.js', 'prepopulate%s.js' % extra])
if self.filter_vertical or self.filter_horizontal:
js.extend(['SelectBox.js', 'SelectFilter2.js'])
return forms.Media(js=[static('admin/js/%s' % url) for url in js])
示例11: _media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def _media(self):
css = {}
js = ()
return Media(css=css, js=js)
示例12: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
return super().media + Media(css=[self.NUMERIC_FILTER_CSS])
示例13: _get_media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def _get_media(self):
return forms.Media(
css={
"all": ("mdeditor/css/editormd.css",)
},
js=(
"mdeditor/js/jquery.min.js",
"mdeditor/js/editormd.min.js",
))
示例14: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
return forms.Media(
css={
"all": [
"wagtail_tag_manager/index.bundle.css",
*self.model_admin.get_index_view_extra_css(),
]
},
js=[
"wagtail_tag_manager/index.bundle.js",
*self.model_admin.get_index_view_extra_js(),
],
)
示例15: media
# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
return forms.Media(js=('suit/js/autosize.min.js',))