當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。