Python django.forms.widgets 模块,Media() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用django.forms.widgets.Media()

项目:deb-python-jingo    作者:openstack    | 项目源码 | 文件源码
def patch():
    from django.forms import forms, formsets, util, widgets

    # Add __html__ methods to these classes:
    classes = [
        forms.BaseForm,
        forms.BoundField,
        formsets.BaseFormSet,
        util.ErrorDict,
        util.ErrorList,
        widgets.Media,
        widgets.RadioFieldRenderer,
    ]
    try:
        classes.append(widgets.RadioChoiceInput)
    except AttributeError:
        classes.append(widgets.RadioInput)

    for cls in classes:
        if not hasattr(cls, '__html__'):
            cls.__html__ = __html__
项目:openvpn-admin    作者:alexsilva    | 项目源码 | 文件源码
def __init__(self, admin_view):
        super(JSHeadPlugin, self).__init__(admin_view)
        self._template = self.admin_view.base_template
        self._media = Media()
项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
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
项目:NarshaTech    作者:KimJangHyeon    | 项目源码 | 文件源码
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
项目:Scrum    作者:prakharchoudhary    | 项目源码 | 文件源码
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
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
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
项目:dal_admin_filters    作者:shamanu4    | 项目源码 | 文件源码
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))
项目:Gypsy    作者:benticarlos    | 项目源码 | 文件源码
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
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
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
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
def media(self):
        js = ["core.js", "SelectBox.js", "SelectFilter2.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:DjangoBlog    作者:0daybug    | 项目源码 | 文件源码
def media(self):
        media = Media(js=[static('admin/js/related-widget-wrapper.js')])
        return self.widget.media + media
项目:wanblog    作者:wanzifa    | 项目源码 | 文件源码
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
项目:tabmaster    作者:NicolasMinghetti    | 项目源码 | 文件源码
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
项目:trydjango18    作者:lucifer-yqh    | 项目源码 | 文件源码
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
项目:trydjango18    作者:lucifer-yqh    | 项目源码 | 文件源码
def media(self):
        js = ["core.js", "SelectBox.js", "SelectFilter2.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:trydjango18    作者:lucifer-yqh    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:trydjango18    作者:lucifer-yqh    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:trydjango18    作者:lucifer-yqh    | 项目源码 | 文件源码
def media(self):
        media = Media(js=['admin/js/related-widget-wrapper.js'])
        return self.widget.media + media
项目:trydjango18    作者:wei0104    | 项目源码 | 文件源码
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
项目:trydjango18    作者:wei0104    | 项目源码 | 文件源码
def media(self):
        js = ["core.js", "SelectBox.js", "SelectFilter2.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:trydjango18    作者:wei0104    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:trydjango18    作者:wei0104    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:trydjango18    作者:wei0104    | 项目源码 | 文件源码
def media(self):
        media = Media(js=['admin/js/related-widget-wrapper.js'])
        return self.widget.media + media
项目:ims    作者:ims-team    | 项目源码 | 文件源码
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
项目:lifesoundtrack    作者:MTG    | 项目源码 | 文件源码
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
项目:django-icekit    作者:ic-labs    | 项目源码 | 文件源码
def _media(self):
        return widgets.Media(
            css={
                'all': ('eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css',)
                },
            js=[
                "moment/moment.js",
                "eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js",
            ]
        )
项目:django-arctic    作者:sanoma    | 项目源码 | 文件源码
def get_media_assets(self):
        media = Media()
        media.add_js(['extra.js'])
        return media
项目:django-arctic    作者:sanoma    | 项目源码 | 文件源码
def _get_common_media(self):
        config = getattr(settings, 'ARCTIC_COMMON_MEDIA_ASSETS', [])
        media = Media()
        if 'css' in config:
            media.add_css(config['css'])
        if 'js' in config:
            media.add_js(config['js'])
        return media
项目:django-arctic    作者:sanoma    | 项目源码 | 文件源码
def get_media_assets(self):
        """
        Allows to define additional media for view
        """
        return Media()
项目:django-arctic    作者:sanoma    | 项目源码 | 文件源码
def _get_view_media(self):
        """
        Gather view-level media assets
        """
        media = Media()
        try:
            media.add_css(self.Media.css)
        except AttributeError:
            pass
        try:
            media.add_js(self.Media.js)
        except AttributeError:
            pass
        return media
项目:django-open-lecture    作者:DmLitov4    | 项目源码 | 文件源码
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
项目:travlr    作者:gauravkulkarni96    | 项目源码 | 文件源码
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
项目:DjangoCMS    作者:farhan711    | 项目源码 | 文件源码
def get_request(self, *args, **kwargs):
        request = super(PluginsTestBaseCase, self).get_request(*args, **kwargs)
        request.placeholder_media = Media()
        request.toolbar = CMSToolbar(request)
        return request
项目:logo-gen    作者:jellene4eva    | 项目源码 | 文件源码
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
项目:liberator    作者:libscie    | 项目源码 | 文件源码
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
项目:gmail_scanner    作者:brandonhub    | 项目源码 | 文件源码
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
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
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
项目:django-prettyjson    作者:kevinmickey    | 项目源码 | 文件源码
def prettyjson_setup(jquery=True):
    widget = PrettyJSONWidget()
    extra = '' if settings.DEBUG else '.min'
    if jquery:
        media = Media(js=('admin/js/vendor/jquery/jquery%s.js' % extra,
                          'admin/js/jquery.init.js',)) + widget.media
    else:
        media = widget.media
    return mark_safe(str(media))
项目:CSCE482-WordcloudPlus    作者:ggaytan00    | 项目源码 | 文件源码
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
项目:tissuelab    作者:VirtualPlants    | 项目源码 | 文件源码
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
项目:producthunt    作者:davidgengler    | 项目源码 | 文件源码
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
项目:django-rtc    作者:scifiswapnil    | 项目源码 | 文件源码
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
项目:geekpoint    作者:Lujinghu    | 项目源码 | 文件源码
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
项目:geekpoint    作者:Lujinghu    | 项目源码 | 文件源码
def media(self):
        js = ["core.js", "SelectBox.js", "SelectFilter2.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:geekpoint    作者:Lujinghu    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:geekpoint    作者:Lujinghu    | 项目源码 | 文件源码
def media(self):
        js = ["calendar.js", "admin/DateTimeShortcuts.js"]
        return forms.Media(js=[static("admin/js/%s" % path) for path in js])
项目:geekpoint    作者:Lujinghu    | 项目源码 | 文件源码
def media(self):
        media = Media(js=[static('admin/js/related-widget-wrapper.js')])
        return self.widget.media + media
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
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