Python django.forms.Media() Examples
The following are 30
code examples of django.forms.Media().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.forms
, or try the search function
.
Example #1
Source File: widgets.py From bioforum with MIT License | 6 votes |
def media(self): extra = '' if settings.DEBUG else '.min' i18n_name = SELECT2_TRANSLATIONS.get(get_language()) i18n_file = ('admin/js/vendor/select2/i18n/%s.js' % i18n_name,) if i18n_name else () return forms.Media( js=( 'admin/js/vendor/jquery/jquery%s.js' % extra, 'admin/js/vendor/select2/select2.full%s.js' % extra, ) + i18n_file + ( 'admin/js/jquery.init.js', 'admin/js/autocomplete.js', ), css={ 'screen': ( 'admin/css/vendor/select2/select2%s.css' % extra, 'admin/css/autocomplete.css', ), }, )
Example #2
Source File: admin.py From django-admin-json-editor with MIT License | 6 votes |
def media(self): css = { 'all': [ 'django_admin_json_editor/fontawesome/css/font-awesome.min.css', 'django_admin_json_editor/style.css', ] } js = [ 'django_admin_json_editor/jsoneditor/jsoneditor.min.js', ] if self._editor_options['theme'] == 'bootstrap4': css['all'].append('django_admin_json_editor/bootstrap/css/bootstrap.min.css') js.append('django_admin_json_editor/jquery/jquery-3.5.1.slim.min.js') js.append('django_admin_json_editor/bootstrap/js/bootstrap.bundle.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)
Example #3
Source File: widgets.py From Hands-On-Application-Development-with-PyCharm with MIT License | 6 votes |
def media(self): extra = '' if settings.DEBUG else '.min' i18n_name = SELECT2_TRANSLATIONS.get(get_language()) i18n_file = ('admin/js/vendor/select2/i18n/%s.js' % i18n_name,) if i18n_name else () return forms.Media( js=( 'admin/js/vendor/jquery/jquery%s.js' % extra, 'admin/js/vendor/select2/select2.full%s.js' % extra, ) + i18n_file + ( 'admin/js/jquery.init.js', 'admin/js/autocomplete.js', ), css={ 'screen': ( 'admin/css/vendor/select2/select2%s.css' % extra, 'admin/css/autocomplete.css', ), }, )
Example #4
Source File: widgets.py From dissemin with GNU Affero General Public License v3.0 | 6 votes |
def media(self): """ Construct Media as a dynamic property. .. Note:: For more information visit https://docs.djangoproject.com/en/stable/topics/forms/media/#media-as-a-dynamic-property """ lang = get_language() select2_js = (settings.SELECT2_JS,) if settings.SELECT2_JS else () select2_css = (settings.SELECT2_CSS,) if settings.SELECT2_CSS else () i18n_name = SELECT2_TRANSLATIONS.get(lang) if i18n_name not in settings.SELECT2_I18N_AVAILABLE_LANGUAGES: i18n_name = None i18n_file = ( ('%s/%s.js' % (settings.SELECT2_I18N_PATH, i18n_name),) if i18n_name else () ) return forms.Media( js=select2_js + i18n_file + (static("js/django_select2.js"), ), css={'screen': select2_css} )
Example #5
Source File: forms.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media(js=[ versioned_static('wagtailsettings/js/site-switcher.js'), ])
Example #6
Source File: menu.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): media = Media() for item in self.registered_menu_items: media += item.media return media
Example #7
Source File: struct_block.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media(js=[versioned_static('wagtailadmin/js/blocks/struct.js')])
Example #8
Source File: views.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media( css={'all': self.model_admin.get_inspect_view_extra_css()}, js=self.model_admin.get_inspect_view_extra_js() )
Example #9
Source File: widgets.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media(js=[ versioned_static('wagtailsnippets/js/snippet-chooser-modal.js'), versioned_static('wagtailsnippets/js/snippet-chooser.js'), ])
Example #10
Source File: wagtail_hooks.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media(js=[static('testapp/js/kittens.js')])
Example #11
Source File: rich_text.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return Media(js=[ 'vendor/custom_editor.js' ])
Example #12
Source File: widgets.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media(js=[ versioned_static('wagtaildocs/js/document-chooser-modal.js'), versioned_static('wagtaildocs/js/document-chooser.js'), ])
Example #13
Source File: views.py From wagtail with BSD 3-Clause "New" or "Revised" License | 5 votes |
def media(self): return forms.Media( css={'all': self.model_admin.get_form_view_extra_css()}, js=self.model_admin.get_form_view_extra_js() )
Example #14
Source File: options.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
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']) if self.classes and 'collapse' in self.classes: js.append('collapse%s.js' % extra) return forms.Media(js=['admin/js/%s' % url for url in js])
Example #15
Source File: helpers.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
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()
Example #16
Source File: widgets.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
def media(self): extra = '' if settings.DEBUG else '.min' js = [ 'vendor/jquery/jquery%s.js' % extra, 'jquery.init.js', 'calendar.js', 'admin/DateTimeShortcuts.js', ] return forms.Media(js=["admin/js/%s" % path for path in js])
Example #17
Source File: widgets.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
def media(self): extra = '' if settings.DEBUG else '.min' js = [ 'vendor/jquery/jquery%s.js' % extra, 'jquery.init.js', 'calendar.js', 'admin/DateTimeShortcuts.js', ] return forms.Media(js=["admin/js/%s" % path for path in js])
Example #18
Source File: widgets.py From Hands-On-Application-Development-with-PyCharm with MIT License | 5 votes |
def media(self): extra = '' if settings.DEBUG else '.min' js = [ 'vendor/jquery/jquery%s.js' % extra, 'jquery.init.js', 'core.js', 'SelectBox.js', 'SelectFilter2.js', ] return forms.Media(js=["admin/js/%s" % path for path in js])
Example #19
Source File: aggregation.py From django_OA with GNU General Public License v3.0 | 5 votes |
def get_media(self, media): return media + Media(css={'screen': [self.static('xadmin/css/xadmin.plugin.aggregation.css'), ]})
Example #20
Source File: util.py From django_OA with GNU General Public License v3.0 | 5 votes |
def vendor(*tags): css = {'screen': []} js = [] for tag in tags: file_type = tag.split('.')[-1] files = xstatic(tag) if file_type == 'js': js.extend(files) elif file_type == 'css': css['screen'] += files return Media(css=css, js=js)
Example #21
Source File: base.py From django_OA with GNU General Public License v3.0 | 5 votes |
def get_media(self): return forms.Media()
Example #22
Source File: dashboard.py From django_OA with GNU General Public License v3.0 | 5 votes |
def media(self): return forms.Media()
Example #23
Source File: editable.py From CTF_AWD_Platform with MIT License | 5 votes |
def get_media(self, media): if self.editable_need_fields: try: m = self.model_form.media except: m = Media() media = media + m +\ self.vendor( 'xadmin.plugin.editable.js', 'xadmin.widget.editable.css') return media
Example #24
Source File: aggregation.py From CTF_AWD_Platform with MIT License | 5 votes |
def get_media(self, media): return media + Media(css={'screen': [self.static('xadmin/css/xadmin.plugin.aggregation.css'), ]})
Example #25
Source File: util.py From CTF_AWD_Platform with MIT License | 5 votes |
def vendor(*tags): css = {'screen': []} js = [] for tag in tags: file_type = tag.split('.')[-1] files = xstatic(tag) if file_type == 'js': js.extend(files) elif file_type == 'css': css['screen'] += files return Media(css=css, js=js)
Example #26
Source File: base.py From CTF_AWD_Platform with MIT License | 5 votes |
def get_media(self): return forms.Media()
Example #27
Source File: dashboard.py From CTF_AWD_Platform with MIT License | 5 votes |
def media(self): return forms.Media()
Example #28
Source File: aggregation.py From myblog with GNU Affero General Public License v3.0 | 5 votes |
def get_media(self, media): return media + Media(css={'screen': [self.static('xadmin/css/xadmin.plugin.aggregation.css'), ]})
Example #29
Source File: util.py From myblog with GNU Affero General Public License v3.0 | 5 votes |
def vendor(*tags): css = {'screen': []} js = [] for tag in tags: file_type = tag.split('.')[-1] files = xstatic(tag) if file_type == 'js': js.extend(files) elif file_type == 'css': css['screen'] += files return Media(css=css, js=js)
Example #30
Source File: base.py From myblog with GNU Affero General Public License v3.0 | 5 votes |
def get_media(self): return forms.Media()