我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用django.forms.Media()。
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])
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)
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]} )
def media(self): css = { 'all': [ 'django_admin_json_editor/bootstrap/css/bootstrap.min.css', 'django_admin_json_editor/fontawesome/css/font-awesome.min.css', 'django_admin_json_editor/style.css', ] } js = [ 'django_admin_json_editor/jquery/jquery.min.js', 'django_admin_json_editor/bootstrap/js/bootstrap.min.js', 'django_admin_json_editor/jsoneditor/jsoneditor.min.js', ] if self._sceditor: css['all'].append('django_admin_json_editor/sceditor/themes/default.min.css') js.append('django_admin_json_editor/sceditor/jquery.sceditor.bbcode.min.js') return forms.Media(css=css, js=js)
def _media(self): """ Include media """ js = ( staticfiles_storage.url("prosemirror/widget.min.js"), ) css = { "all": ( staticfiles_storage.url( "prosemirror/widget.min.css"), ) } return forms.Media(css=css, js=js)
def _get_media(self): """ Construct Media as a dynamic property. .. Note:: For more information visit https://docs.djangoproject.com/en/1.8/topics/forms/media/#media-as-a-dynamic-property """ return forms.Media( js=(settings.SELECT2_JS, 'django_select2/django_select2.js'), css={'screen': (settings.SELECT2_CSS,)} )
def media(self): return forms.Media(js=[static("suit/js/jquery.autosize-min.js")])
def media(self): js = ["core.js", "SelectBox.js", "SelectFilter2.js"] return forms.Media(js=[static("admin/js/%s" % path) for path in js])
def media(self): js = ["calendar.js", "admin/DateTimeShortcuts.js"] return forms.Media(js=[static("admin/js/%s" % path) for path in js])
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()
def media(self): extra = '' if settings.DEBUG else '.min' 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])
def media(self): js = ["core.js", "SelectBox.js", "SelectFilter2.js"] return forms.Media(js=["admin/js/%s" % path for path in js])
def media(self): js = ["calendar.js", "admin/DateTimeShortcuts.js"] return forms.Media(js=["admin/js/%s" % path for path in js])
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=['admin/js/%s' % url for url in js]) return forms.Media()
def media(self): extra = '' if settings.DEBUG else '.min' 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=['admin/js/%s' % url for url in js])
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)
def _get_media(): js = [ 'calendar.js', 'admin/DateTimeShortcuts.js', ] css = [ 'widgets.css', ] return forms.Media( js=['admin/js/%s' % url for url in js], css={'all': ['admin/css/%s' % path for path in css]} )
def media(self): return forms.Media()
def get_media(self): return forms.Media()
def vendor(*tags): media = Media() for tag in tags: file_type = tag.split('.')[-1] files = xstatic(tag) if file_type == 'js': media.add_js(files) elif file_type == 'css': media.add_css({'screen': files}) return media
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=['admin/js/%s' % url for url in js]) return forms.Media()
def media(self): return forms.Media(js=('suit/js/autosize.min.js',))
def media(self): return Media( js=[ 'plugins/simplemde/simplemde.min.js', 'plugins/simplemde/simplemde.attach.js' ], css={ 'all': ('plugins/simplemde/simplemde.min.css',) } )
def media(self): if not isinstance(self, InlineModelAdmin): context = {'field': self.ordering_field} else: if not self.fk_name: raise ImproperlyConfigured( '%r requires a `fk_name` -- we are too dumb/lazy to' ' determine it ourselves. Thanks!' % (self.__class__)) context = { 'field': self.ordering_field, 'prefix': get_default_formset_prefix( self.parent_model, self.model, self.fk_name), 'stacked': isinstance(self, admin.StackedInline), 'tabular': isinstance(self, admin.TabularInline), } return super(OrderableAdmin, self).media + forms.Media( css={'all': ( 'admin_ordering/admin_ordering.css', )}, js=[ 'admin_ordering/jquery-ui-1.11.4.custom.min.js', JS('admin_ordering/admin_ordering.js', { 'class': 'admin-ordering-context', 'data-context': json.dumps(context), }), ], )
def media(self): parent_media = super(CardsBlock, self).media cards_css = { 'screen': (static('wagtailblocks_cards/css/wagtailblocks_cards.css'),) } cards_media = forms.Media(css=cards_css) return parent_media + cards_media
def media(self): return super().media + forms.Media( js=( 'admin/js/customize.js', ), )