Add link to main page on grappelli admin

1.5k views Asked by At

Is there a simple way to add a link back to the main site when using the grappelli admin interface with django?

So when the user goes into the admin interface at

http://myurl/admin/

I'd like a link somewhere back to

http://myurl/ 

for the main site.

The only way I can see of doing this is to edit the grappelli templates, which feels very hacky for such a simple task.

2

There are 2 answers

0
kanu On

You can use the grappelli dashboard to make a box with custom links on the admin index. After installing the dashboard you can use the LinkList to add links.

class CustomIndexDashboard(Dashboard):

    def init_with_context(self, context):
        ...
        self.children.append(modules.LinkList(
            _('Links'),
            column=2,
            children=[
                {
                    'title': u'Homepage',
                    'url': '/',
                    'external': False,
                },
            ]
        ))
3
djsutho On

You can add a link to the admin title (top left corner) by adding the following to your settings.py:

GRAPPELLI_ADMIN_TITLE = '<a href="/">Homepage</a>'