當前位置: 首頁>>代碼示例>>Python>>正文


Python forms.Media方法代碼示例

本文整理匯總了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) 
開發者ID:abogushov,項目名稱:django-admin-json-editor,代碼行數:22,代碼來源:admin.py

示例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',
                ),
            },
        ) 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:21,代碼來源:widgets.py

示例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}
        ) 
開發者ID:dissemin,項目名稱:dissemin,代碼行數:26,代碼來源:widgets.py

示例4: media

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def media(self):
        return forms.Media() 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:4,代碼來源:dashboard.py

示例5: get_media

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def get_media(self):
        return forms.Media() 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:4,代碼來源:base.py

示例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 
開發者ID:stormsha,項目名稱:StormOnline,代碼行數:12,代碼來源:util.py

示例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,)}
        ) 
開發者ID:raonyguimaraes,項目名稱:mendelmd,代碼行數:13,代碼來源:forms.py

示例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]) 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:5,代碼來源:widgets.py

示例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() 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:10,代碼來源:helpers.py

示例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]) 
開發者ID:lanbing510,項目名稱:GTDWeb,代碼行數:10,代碼來源:options.py

示例11: _media

# 需要導入模塊: from django import forms [as 別名]
# 或者: from django.forms import Media [as 別名]
def _media(self):
        css = {}
        js = ()
        return Media(css=css, js=js) 
開發者ID:awemulya,項目名稱:kobo-predict,代碼行數:6,代碼來源:forms.py

示例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]) 
開發者ID:lukasvinclav,項目名稱:django-admin-numeric-filter,代碼行數:4,代碼來源:forms.py

示例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",
            )) 
開發者ID:pylixm,項目名稱:django-mdeditor,代碼行數:11,代碼來源:widgets.py

示例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(),
            ],
        ) 
開發者ID:jberghoef,項目名稱:wagtail-tag-manager,代碼行數:15,代碼來源:views.py

示例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',)) 
開發者ID:82Flex,項目名稱:DCRM,代碼行數:4,代碼來源:widgets.py


注:本文中的django.forms.Media方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。