def changelist_view(self, request, *args, **kwargs): if request.is_ajax() and request.POST.get('cmd') == 'move_node': return self._move_node(request) response = super(DraggableMPTTAdmin, self).changelist_view(request, *args, **kwargs) try: response.context_data[ 'media'] = response.context_data['media'] + forms.Media( css={ 'all': ['mptt/draggable-admin.css'], }, js=[ JS( 'mptt/draggable-admin.js', { 'id': 'draggable-admin-context', 'data-context': json.dumps(self._tree_context(request), cls=DjangoJSONEncoder), }), ], ) except (AttributeError, KeyError): # Not meant for us if there is no context_data attribute (no # TemplateResponse) or no media in the context. pass return response
def changelist_view(self, request, *args, **kwargs): if request.POST.get("cmd") == "move_node": return self._move_node(request) response = super().changelist_view(request, *args, **kwargs) try: response.context_data["media"] = response.context_data[ "media" ] + forms.Media( css={ "all": ["mptt/draggable-admin.css"], }, js=[ "admin/js/vendor/jquery/jquery.js", "admin/js/jquery.init.js", JS( "mptt/draggable-admin.js", { "id": "draggable-admin-context", "data-context": json.dumps( self._tree_context(request), cls=DjangoJSONEncoder ), }, ), ], ) except (AttributeError, KeyError): # Not meant for us if there is no context_data attribute (no # TemplateResponse) or no media in the context. pass return response
class Media: # js js = ( JS('wangeditor/wangeditor-init.js', { 'id': 'wangeditor-init-script', }), 'wangeditor/wangEditor.min.js', )
class Media: js = ( 'admin/js/jquery.init.js', JS('https://use.fontawesome.com/0fc4ca6dfe.js', { 'async': 'async', 'crossorigin': 'anonymous', }, static=False), 'admin/plugin_buttons.js', )
class Media: js = ( "admin/js/jquery.init.js", JS( "https://kit.fontawesome.com/91a6274901.js", {"async": "async", "crossorigin": "anonymous",}, static=False, ), "admin/plugin_buttons.js", )
class Media: js = ( JS('ckeditor/ckeditor-init.js', { 'id': 'ckeditor-init-script', 'data-ckeditor-basepath': getattr( settings, 'CKEDITOR_BASEPATH', static('ckeditor/ckeditor/'), ), }), 'ckeditor/ckeditor/ckeditor.js', )
class Media: js = ( JS( 'https://use.fontawesome.com/releases/v5.0.10/js/all.js', { 'async': 'async', 'integrity': 'sha384-slN8GvtUJGnv6ca26v8EzVaR9DC58QEwsIk9q1QXdCU8Yu8ck/tL/5szYlBbqmS+', # noqa 'crossorigin': 'anonymous', }, static=False), 'app/plugin_buttons.js', )
class Media: js = () try: js += ( JS( 'ckeditor/ckeditor-init.js', { 'id': 'ckeditor-init-script', 'data-ckeditor-basepath': getattr( settings, 'CKEDITOR_BASEPATH', static('ckeditor/ckeditor/'), ), }), JS('ckeditor/ckeditor/ckeditor.js', None), ) except AttributeError: raise ImproperlyConfigured("django-ckeditor requires \ CKEDITOR_MEDIA_PREFIX setting. This setting specifies a \ URL prefix to the ckeditor JS and CSS media (not \ uploaded media). Make sure to use a trailing slash: \ CKEDITOR_MEDIA_PREFIX = '/media/ckeditor/'")
class Media: js = ( JS( "ckeditor/ckeditor-init.js", { "id": "ckeditor-init-script", "data-ckeditor-basepath": getattr( settings, "CKEDITOR_BASEPATH", static("ckeditor/ckeditor/"), ), }, ), "ckeditor/ckeditor/ckeditor.js", )
def media(self): if not isinstance(self, InlineModelAdmin): # Editable change list context = { "field": self.ordering_field, "fieldHideInput": self.ordering_field_hide_input, } else: # Find our helper.InlineAdminFormSet so that we may access # the formset instance and its prefix frame = inspect.currentframe() while frame: helper = frame.f_locals.get("self") if isinstance(helper, InlineAdminFormSet): break frame = frame.f_back del frame context = { "field": self.ordering_field, "fieldHideInput": self.ordering_field_hide_input, "prefix": helper.formset.prefix, "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/js/jquery.init.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), }, ), ], )
class Media: js = ( JS("rhoeditor/rhoeditor/ace.js", {}), JS("rhoeditor/rhoeditor/ext-language_tools.js", {}) )
class Media: js = (JS('make_queue/js/machine_create.js', attrs={'defer': 'defer'}), )
class Media: js = (JS('make_queue/js/quota_edit.js', attrs={'defer': 'defer'}), )
class Media: js = ('ueditor/ueditor.all.js', 'ueditor/lang/zh-cn/zh-cn.js', JS('ueditor/ueditor.init.js'), )