Safari
Safari

Reputation: 11965

Customize Django-Grappelli CSS

I need to edit my django-grappelli admin panel. I would to change the base.css file to change some components and colors.

What is the best way to make this?

Upvotes: 1

Views: 2896

Answers (1)

ninapavlich
ninapavlich

Reputation: 749

Rather than change the grappelli base.css file, a more sustainable solution would be to create a css file with styles that override the grappelli styles.

If you define a custom dashboard, you can specify .css and .js files to include in the dashboard index:

In your settings.py:

#settings.py
GRAPPELLI_INDEX_DASHBOARD = 'app.dashboard.AdminDashboard'

Dashboard:

#app/dashboard.py
from grappelli.dashboard import Dashboard

class AdminDashboard(Dashboard):

    class Media:
        css = {
            'all': (
                'css/mydashboard.css',
                'css/mystyles.css',
            ),
        }
        js = (
            'js/mydashboard.js',
            'js/myscript.js',
        )

Upvotes: 5

Related Questions