Search code examples
djangomezzaninedjango-grappelli

Django grappeli - include link to custom admin page in side-panel dropdown-menu


I use Django 1.7 with Mezzaine.

I create a custom admin page according to: Django - custom admin page not releated to a model

I would like to include link to that page to grappeli side-panel dropdown-menu. Is there a way how to achieve that without touching the side-panel template?


Solution

  • Look for the ADMIN_MENU_ORDER-constant in your settings.py.

    It probably looks like this:

    # ADMIN_MENU_ORDER = (
    #     ("Content", ("pages.Page", "blog.BlogPost",
    #        "generic.ThreadedComment", ("Media Library", "fb_browse"),)),
    #     ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
    #     ("Users", ("auth.User", "auth.Group",)),
    # )
    

    You have to uncomment these lines first. Assuming your recently created admin page is called verycustom.SuchCustomPage, you have to insert it at the desired position in your menu-list.

    Example:

    ADMIN_MENU_ORDER = (
         ("Content", ("pages.Page", "verycustom.SuchCustomPage", "blog.BlogPost",
            "generic.ThreadedComment", ("Media Library", "fb_browse"))),
         ("Site", ("sites.Site", "redirects.Redirect", "conf.Setting")),
         ("Users", ("auth.User", "auth.Group",)),
    )
    

    Edit: You'll find a detailed explaination in the official documentation.