unfoldadmin / django-unfold

Modern Django admin theme for seamless interface development
https://unfoldadmin.com
MIT License
1.9k stars 187 forks source link

New setting to define extra navigation links #823

Open Zerotask opened 4 weeks ago

Zerotask commented 4 weeks ago

image

Is it a third party application feature request?

No

Describe your feature request

We'd like to show all applications and models (SIDEBAR.show_all_applications) and define some extra navigation links before those (dashboard, show website, some external links, some custom sites etc). If you define those links in SIDEBAR.navigation, then it shows only those links but not show_all_applications. Therefore we suggest to add a new setting SIDEBAR.extend_navigation, to easily add new navigation links without the need to define every single app and model in the settings and just show them all.

lukasvinclav commented 3 days ago

Do you have any examples how you want to specify additional links? How you want to declare the position of these links in the whole navigation?

Zerotask commented 2 days ago

I'd like to define it kinda similar to SIDEBAR.navigation. It could be extra_navigation, extend_navigation or you split it like navigation_top and navigation_bottom. The order would then be:

In case you don't split it, then there must be a field position.

Example:

UNFOLD = {
    "SIDEBAR": {
        "navigation_top": [
            {
                "title": _("Navigation"),
                "separator": True,
                "items": [
                    {
                        "title": _("Dashboard"),
                        "icon": "dashboard",
                        "link": reverse_lazy("admin:index"),
                        "permission": lambda request: request.user.is_superuser,
                    },
                    {
                        "title": _("Website"),
                        "icon": "home",
                        "link": reverse_lazy("index"),
                    },
                ],
            },
        ],
    },
}