diff --git a/CHANGELOG.md b/CHANGELOG.md index a51ae89..fd6c9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/ ### Added - Support for the `django.templates.backends.jinja2.Jinja2` template engine backend. +- Support for Django 5.2. ### New Contributors diff --git a/README.md b/README.md index f4c544b..5d27db9 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [![PyPI](https://img.shields.io/pypi/v/django-simple-nav)](https://pypi.org/project/django-simple-nav/) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-simple-nav) -![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0%20%7C%205.1-%2344B78B?labelColor=%23092E20) +![Django Version](https://img.shields.io/badge/django-4.2%20%7C%205.0%20%7C%205.1%20%7C%20-%2344B78B?labelColor=%23092E20) - + `django-simple-nav` is a Python/Django application designed to simplify the integration of navigation and menu bars in your Django projects. With a straightforward API and customizable options, you can easily add and manage navigational elements in your web applications. It is designed to be simple to start with, but flexible enough to handle complex navigation structures while maintaining that same simplicity. @@ -13,7 +13,7 @@ ## Requirements - Python 3.9, 3.10, 3.11, 3.12, 3.13 -- Django 4.2, 5.0, 5.1 +- Django 4.2, 5.0, 5.1, 5.2 ## Installation diff --git a/noxfile.py b/noxfile.py index b8adb67..83d65b4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -21,10 +21,10 @@ DJ42 = "4.2" DJ50 = "5.0" DJ51 = "5.1" -DJ52 = "5.2a1" +DJ52 = "5.2" DJMAIN = "main" DJMAIN_MIN_PY = PY312 -DJ_VERSIONS = [DJ42, DJ50, DJ51, DJMAIN] +DJ_VERSIONS = [DJ42, DJ50, DJ51, DJ52, DJMAIN] DJ_LTS = [ version for version in DJ_VERSIONS if version.endswith(".2") and version != DJMAIN ] diff --git a/pyproject.toml b/pyproject.toml index 24f71bb..c3724cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,7 @@ classifiers = [ "Framework :: Django :: 4.2", "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", + "Framework :: Django :: 5.2", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", diff --git a/src/django_simple_nav/nav.py b/src/django_simple_nav/nav.py index 1d85585..d40345b 100644 --- a/src/django_simple_nav/nav.py +++ b/src/django_simple_nav/nav.py @@ -37,7 +37,7 @@ def render(self, request: HttpRequest, template_name: str | None = None) -> str: template = self.get_template(template_name) if isinstance(template, str): engine = get_template_engine() - template = engine.from_string(template) + template: EngineTemplate = engine.from_string(template) # type: ignore[no-redef] return template.render(context, request) def get_context_data(self, request: HttpRequest) -> dict[str, object]: @@ -53,8 +53,10 @@ def get_items(self, request: HttpRequest) -> list[NavGroup | NavItem]: msg = f"{self.__class__!r} must define 'items' or override 'get_items()'" raise ImproperlyConfigured(msg) - def get_template(self, template_name: str | None = None) -> EngineTemplate | str: - return get_template(template_name=template_name or self.get_template_name()) + def get_template(self, template_name: str | None = None) -> EngineTemplate: + template_name = template_name or self.get_template_name() + template = get_template(template_name=template_name) + return cast(EngineTemplate, template) def get_template_name(self) -> str: if self.template_name is not None: