3

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 Answers2

3

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,
                },
            ]
        ))
kanu
  • 726
  • 5
  • 9
1

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>'
djsutho
  • 5,174
  • 1
  • 23
  • 25
  • 1
    Simple and works well except that it shows html in the window's title – Mark Jun 06 '15 at 20:02
  • @Mark well spotted I've never noticed that before. – djsutho Jun 08 '15 at 23:48
  • 1
    You can try using `'Homepage'` but I think you'd be better off looking into overriding grappelli templates. – djsutho Jun 09 '15 at 00:35