django-pagedown seems to be overriding the default Django admin styling -- did I do something wrong with `collectstatic`?

StackOverflow https://stackoverflow.com/questions/19279971

Question

I've just installed django-pagedown according to this post. I added in all the code and once I did a ./manage.py collectstatic, I noticed that when I navigated to any DetailPage in the admin (e.g. to add/edit an object), the styling changes.

For example, this is the styling of an object's ListPage:

ListPage styling

And this is the "new" styling of an object's DetailPage (and where the AdminPagedownWidget is located):

DetailPage styling

The change is pretty subtle -- the font is different / slightly narrower. Of course, this isn't a huge deal, and I'm super stoked to have a live preview of my markdown content... but does anyone know why this is happening? I suspect it has to do with how Django's collectstatic works, and django-pagedown's CSS is overriding the default admin's CSS... but it feels to me that the base CSS of the admin pages shouldn't be altered, so maybe I've done something wrong when collecting static files. I already took a look at the options that collectstatic comes with, and tried it with the --clean option, but that didn't seem to solve anything. I looked at the source code and saw that the pagedown styles are indeed being loaded after the admin styles, but how would I go about changing that order in the admin interface?

Was it helpful?

Solution

There's a bug. The AdminPagedownWidget is also importing the css file for the normal PagedownWidget which means there are two css files being imported to your template; the former CSS file (demo.css) is imposing a font on the body tag.

I'm the django-pagedown author so I'll fix it now - well spotted!

Edit: If you reinstall/update it should be fixed now pip install django-pagedown=0.0.5

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top