[Answered ]-Django: admin widget css?

2👍

I have no idea why the required css file is not included in the widget media by default, as form.media is supposed to collect all media files for the widgets used in that form… I quickly tried it out myself and run into the same problem.

The css file that you would need to include seems to be widgets.css. Adding this to my form made it work for me:

class Media:
    css = {
        'all': ['{0}css/widgets.css'.format(settings.ADMIN_MEDIA_PREFIX), ]
    }

Let me know if this answers your question! I’m new to SO so any feedback is welcome:)

👤Wesley

0👍

I don’t know the answer, but I know how I’d find it. I’d put that widget in the admin (maybe you already have an example) and then load the page it’s on in my browser. Then I’d open up Chrome Developer Tools or Firebug in Firefox and use the element inspector. Select the HTML element from the widget in question and look in the CSS pane to see what CSS files are contributing to its layout. You’ll also see what rules they’re matching – quite possibly you already have the file you need but it needs to be inside a particular container to layout properly.

0👍

Can you tried override the widget?

In this link you see this

I have an app and I override the textArea widget to use the TinyMCE editor. Like this

Leave a comment