From 227eaaeb9b3f002f221f618c69a9681f8db2a721 Mon Sep 17 00:00:00 2001 From: Kai Schlamp Date: Fri, 9 Feb 2024 12:43:15 +0000 Subject: [PATCH] Type hint nav_menu_items --- radis/core/site.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/radis/core/site.py b/radis/core/site.py index 327c228b..d672218d 100644 --- a/radis/core/site.py +++ b/radis/core/site.py @@ -1,14 +1,20 @@ -from typing import Any +from typing import Any, NamedTuple from django.conf import settings from django.http import HttpRequest from django.middleware.csrf import get_token -nav_menu_items = [] + +class NavMenuItem(NamedTuple): + url_name: str + label: str + + +nav_menu_items: list[NavMenuItem] = [] def register_main_menu_item(url_name: str, label: str) -> None: - nav_menu_items.append({"url_name": url_name, "label": label}) + nav_menu_items.append(NavMenuItem(url_name, label)) def base_context_processor(request: HttpRequest) -> dict[str, Any]: