1

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?

Safari
  • 11,437
  • 24
  • 91
  • 191

1 Answers1

4

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',
        )
ninapavlich
  • 739
  • 2
  • 10
  • 30