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