当前位置: 首页>>代码示例>>Python>>正文


Python widgets.Media方法代码示例

本文整理汇总了Python中django.forms.widgets.Media方法的典型用法代码示例。如果您正苦于以下问题:Python widgets.Media方法的具体用法?Python widgets.Media怎么用?Python widgets.Media使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.forms.widgets的用法示例。


在下文中一共展示了widgets.Media方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def media(self):
        # get the default js and css media
        media = super().media

        # remove the jQuery script manually
        # this causes errors with datepicker-plus,
        # see https://github.com/monim67/django-bootstrap-datepicker-plus/issues/42
        # TODO this code patch can be removed in future,
        # because of https://github.com/yourlabs/django-autocomplete-light/commit/e46300d
        regex = re.compile(r"^admin/.*jquery(\.min)?\.js$")
        filtered_js = [item for item in media._js if not regex.search(item)]
        filtered_js.append("js/dal_fixes.js")

        # add custom css
        new_css = media._css
        new_css["screen"].append("css/autocomplete-light.css")

        return Media(js=tuple(filtered_js), css=new_css) 
开发者ID:iguana-project,项目名称:iguana,代码行数:20,代码来源:widgets.py

示例2: __init__

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def __init__(self, admin_view):
        super(JSHeadPlugin, self).__init__(admin_view)
        self._template = self.admin_view.base_template
        self._media = Media() 
开发者ID:alexsilva,项目名称:openvpn-admin,代码行数:6,代码来源:jshead.py

示例3: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def media(self):
        """
        Provide a description of all media required to render the widgets on this form
        """
        media = Media()
        for field in self.fields.values():
            media = media + field.widget.media
        return media 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:10,代码来源:forms.py

示例4: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets 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

示例5: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def media(self):
        return Media(
            css={"screen": _get_css(settings.DEBUG)}, js=_get_js(settings.DEBUG)
        ) 
开发者ID:MarkusH,项目名称:django-osm-field,代码行数:6,代码来源:widgets.py

示例6: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def media(self):
        """Return all media required to render the widgets on this form."""
        media = Media()
        for field in self.fields.values():
            media = media + field.widget.media
        return media 
开发者ID:reBiocoder,项目名称:bioforum,代码行数:8,代码来源:forms.py

示例7: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def media(self):
        extra = '' if settings.DEBUG else '.min'
        return widgets.Media(
            js=(
                'admin/js/vendor/jquery/jquery%s.js' % extra,
                'admin/js/jquery.init.js',
                'prettyjson/prettyjson.js',
            ),
            css={
                'all': ('prettyjson/prettyjson.css', )
            },
        ) 
开发者ID:kevinmickey,项目名称:django-prettyjson,代码行数:14,代码来源:widgets.py

示例8: get_media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def get_media(self):
        try:
            m = self.form_obj.media
        except:
            m = Media()
        return super(ModelFormAdminView, self).get_media() + m + \
            self.vendor('xadmin.page.form.js', 'xadmin.form.css') 
开发者ID:Superbsco,项目名称:weibo-analysis-system,代码行数:9,代码来源:edit.py

示例9: _add_media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def _add_media(self, model_admin):

        if not hasattr(model_admin, 'Media'):
            raise ImproperlyConfigured('Add empty Media class to %s. Sorry about this bug.' % model_admin)

        def _get_media(obj):
            return Media(media=getattr(obj, 'Media', None))

        media = _get_media(model_admin) + _get_media(AutocompleteFilter) + _get_media(self)

        for name in MEDIA_TYPES:
            setattr(model_admin.Media, name, getattr(media, "_" + name)) 
开发者ID:shamanu4,项目名称:dal_admin_filters,代码行数:14,代码来源:__init__.py

示例10: media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def media(self):
        js = []
        js.extend(settings.CONFIG['js'])
        js.append(reverse(self.INIT_URL))
        return Media(js=js, css=settings.CONFIG['css']) 
开发者ID:jaap3,项目名称:django-richtextfield,代码行数:7,代码来源:widgets.py

示例11: _get_media

# 需要导入模块: from django.forms import widgets [as 别名]
# 或者: from django.forms.widgets import Media [as 别名]
def _get_media(self):
        """
        Provide a description of all media required to render the widgets on this form
        """
        media = Media()
        for field in self.fields.values():
            media = media + field.widget.media
        return media 
开发者ID:blackye,项目名称:luscan-devel,代码行数:10,代码来源:forms.py


注:本文中的django.forms.widgets.Media方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。