From 7ff379ee3f5b005838e562d43ea37ce334708b53 Mon Sep 17 00:00:00 2001 From: "Jacek \"d33tah\" Wielemborek" Date: Tue, 28 Jan 2025 17:01:59 +0100 Subject: [PATCH 1/2] Fix TypeError: 'type' object is not subscriptable --- django_tables2/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django_tables2/views.py b/django_tables2/views.py index b972c0a0..58e2e285 100644 --- a/django_tables2/views.py +++ b/django_tables2/views.py @@ -1,5 +1,5 @@ from itertools import count -from typing import Any, Optional +from typing import Any, Optional, Dict from django.core.exceptions import ImproperlyConfigured from django.views.generic.list import ListView @@ -152,7 +152,7 @@ def get_table_kwargs(self): """ return {} - def get_context_data(self, **kwargs: Any) -> dict[str, Any]: + def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: """ Overridden version of `.TemplateResponseMixin` to inject the table into the template's context. @@ -227,7 +227,7 @@ def get_tables_data(self): """ return self.tables_data - def get_context_data(self, **kwargs: Any) -> dict[str, Any]: + def get_context_data(self, **kwargs: Any) -> Dict[str, Any]: context = super().get_context_data(**kwargs) tables = self.get_tables() From a7f07e14b31d0bea3edaccd21904589d05724722 Mon Sep 17 00:00:00 2001 From: "Jacek \"d33tah\" Wielemborek" Date: Tue, 28 Jan 2025 17:15:58 +0100 Subject: [PATCH 2/2] Add changelog, bump version --- CHANGELOG.md | 4 ++++ django_tables2/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf878c4..441e23a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 2.7.6 (2025-01-28) + +- Fix type annotations for get_context_data ([#987](https://github.com/jieter/django-tables2/pull/987)) by [@d33tah](https://github.com/d33tah) + ## 2.7.5 (2025-01-02) - Update django.po for Ukrainian πŸ‡ΊπŸ‡¦ ([#934](https://github.com/jieter/django-tables2/pull/934)) by [@DmytroLitvinov](https://github.com/DmytroLitvinov) diff --git a/django_tables2/__init__.py b/django_tables2/__init__.py index 624afb1b..21f62096 100644 --- a/django_tables2/__init__.py +++ b/django_tables2/__init__.py @@ -20,7 +20,7 @@ from .utils import A from .views import MultiTableMixin, SingleTableMixin, SingleTableView -__version__ = "2.7.5" +__version__ = "2.7.6" __all__ = ( "Table",