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


Python admin_static.static方法代码示例

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


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

示例1: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def media(self):
        # taken from django.contrib.admin.options ModelAdmin
        extra = '' if settings.DEBUG else '.min'
        # if VERSION <= (1, 8):
        if StrictVersion(get_version()) < StrictVersion('1.9'):
            js = [
                'core.js',
                'admin/RelatedObjectLookups.js',
                'jquery%s.js' % extra,
                'jquery.init.js',
            ]
        else:
            js = [
                'core.js',
                'vendor/jquery/jquery%s.js' % extra,
                'jquery.init.js',
                'admin/RelatedObjectLookups.js',
                'actions%s.js' % extra,
                'urlify.js',
                'prepopulate%s.js' % extra,
                'vendor/xregexp/xregexp%s.js' % extra,
            ]
        return forms.Media(js=[static('admin/js/%s' % url) for url in js]) 
开发者ID:simplyopen-it,项目名称:django-admin-reports,代码行数:25,代码来源:views.py

示例2: _media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def _media(self):
        js = [
            "image_cropping/js/jquery.Jcrop.min.js",
            "image_cropping/image_cropping.js",
            os.path.join(URL_FILEBROWSER_MEDIA, 'js/AddFileBrowser.js')
        ]
        js = [admin_static.static(path) for path in js]

        if settings.IMAGE_CROPPING_JQUERY_URL:
            js.insert(0, settings.IMAGE_CROPPING_JQUERY_URL)

        css = [
            "image_cropping/css/jquery.Jcrop.min.css",
            "image_cropping/css/image_cropping.css",
        ]
        css = {'all': [admin_static.static(path) for path in css]}

        return forms.Media(css=css, js=js) 
开发者ID:chazmead,项目名称:django-clubhouse,代码行数:20,代码来源:widgets.py

示例3: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def media(self):
        extra = '' if settings.DEBUG else '.min'
        js = [
            'core.js',
            'admin/RelatedObjectLookups.js',
            'jquery%s.js' % extra,
            'jquery.init.js'
        ]
        css = [
            'block_admin.css'
        ]
        # if self.actions is not None:
        #     js.append('actions%s.js' % extra)
        # if self.prepopulated_fields:
        #     js.extend(['urlify.js', 'prepopulate%s.js' % extra])

        return forms.Media(
            js=[static('admin/js/%s' % url) for url in js],
            css={'all': [static('admin/css/%s' % url) for url in css]}
        ) 
开发者ID:chazmead,项目名称:django-clubhouse,代码行数:22,代码来源:options.py

示例4: render

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def render(self, name, value, attrs=None, choices=()):
        output = [super(ApplicationConfigSelect, self).render(name, value, attrs, choices)]
        output.append('<script>\n')
        output.append('var apphooks_configuration = {\n')
        for application, cms_app in self.app_configs.items():
            output.append("'%s': [%s]," % (application, ",".join(["['%s', '%s']" % (config.pk, force_text(config)) for config in cms_app.get_configs()])))
        output.append('\n};\n')
        output.append('var apphooks_configuration_url = {\n')
        for application, cms_app in self.app_configs.items():
            output.append("'%s': '%s'," % (application, cms_app.get_config_add_url()))
        output.append('\n};\n')
        output.append('var apphooks_configuration_value = \'%s\';\n' % value)
        output.append('</script>')

        related_url = ''
        output.append('<a href="%s" class="add-another" id="add_%s" onclick="return showAddAnotherPopup(this);"> '
                      % (related_url, name))
        output.append('<img src="%s" width="10" height="10" alt="%s"/></a>'
                      % (static('admin/img/icon_addlink.gif'), _('Add Another')))
        return mark_safe(''.join(output)) 
开发者ID:farhan711,项目名称:DjangoCMS,代码行数:22,代码来源:widgets.py

示例5: init_add_fields

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def init_add_fields(self):
        for field_name, url_name in getattr(self.Meta, 'add_fields', {}).items():
            try:
                url = reverse(url_name)
            except NoReverseMatch:
                url = reverse(url_name, args=[self.instance.pk])
            # self.fields[field_name].label_suffix = ""  # suffix not supported by django-crispy-forms
            url += '?auto_select_field=' + field_name
            self.fields[field_name].label += self.field_label_addon.format(
                url, static('admin/img/icon-addlink.svg'), 'Add'
            ) 
开发者ID:Pyco7,项目名称:django-ajax-views,代码行数:13,代码来源:forms.py

示例6: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def media(self):
        return forms.Media(js=[static("suit/js/jquery.autosize-min.js")]) 
开发者ID:meaningful,项目名称:ecs_sclm,代码行数:4,代码来源:widgets.py

示例7: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [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:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:5,代码来源:widgets.py

示例8: _media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def _media(self):
        if 'collapse' in self.classes:
            extra = '' if settings.DEBUG else '.min'
            js = ['vendor/jquery/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:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:10,代码来源:helpers.py

示例9: _boolean_icon

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def _boolean_icon(field_val):
    icon_url = static('admin/img/icon-%s.svg' %
                      {True: 'yes', False: 'no', None: 'unknown'}[field_val])
    return format_html('<img src="{}" alt="{}" />', icon_url, field_val) 
开发者ID:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:6,代码来源:admin_list.py

示例10: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def media(self):
        extra = '' if settings.DEBUG else '.min'
        js = ['vendor/jquery/jquery%s.js' % extra, 'jquery.init.js',
              'inlines%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:ComputerSocietyUNB,项目名称:CodingDojo,代码行数:9,代码来源:options.py

示例11: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def media(self):
        internal_js = [
            "happenings/underscore-min.js",
            "happenings/hstore-widget.js"
        ]

        js = [static(path) for path in internal_js]

        return forms.Media(js=js) 
开发者ID:natgeosociety,项目名称:django-happenings,代码行数:11,代码来源:widgets.py

示例12: render

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def render(self, name, value, attrs=None, choices=()):
        if attrs is None:
            attrs = {}
        attrs['class'] = 'selectfilter'
        if self.is_stacked:
            attrs['class'] += 'stacked'
        output = [super(FilteredSelectMultiple, self).render(name, value, attrs, choices)]
        output.append('<script type="text/javascript">addEvent(window, "load", function(e) {')
        # TODO: "id_" is hard-coded here. This should instead use the correct
        # API to determine the ID dynamically.
        output.append('SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n'
            % (name, self.verbose_name.replace('"', '\\"'), int(self.is_stacked), static('admin/')))
        return mark_safe(''.join(output)) 
开发者ID:0daybug,项目名称:DjangoBlog,代码行数:15,代码来源:widgets.py

示例13: _boolean_icon

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def _boolean_icon(field_val):
    icon_url = static('admin/img/icon-%s.gif' %
                      {True: 'yes', False: 'no', None: 'unknown'}[field_val])
    return format_html('<img src="{}" alt="{}" />', icon_url, field_val) 
开发者ID:0daybug,项目名称:DjangoBlog,代码行数:6,代码来源:admin_list.py

示例14: media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [as 别名]
def media(self):
        extra = '' if settings.DEBUG else '.min'
        js = [
            'core.js',
            'admin/RelatedObjectLookups.js',
            'jquery%s.js' % extra,
            'jquery.init.js'
        ]
        if self.actions is not None:
            js.append('actions%s.js' % extra)
        if self.prepopulated_fields:
            js.extend(['urlify.js', 'prepopulate%s.js' % extra])
        return forms.Media(js=[static('admin/js/%s' % url) for url in js]) 
开发者ID:0daybug,项目名称:DjangoBlog,代码行数:15,代码来源:options.py

示例15: _media

# 需要导入模块: from django.contrib.admin.templatetags import admin_static [as 别名]
# 或者: from django.contrib.admin.templatetags.admin_static import static [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:lucifer-yqh,项目名称:trydjango18,代码行数:10,代码来源:helpers.py


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