From 4f3707fa245ea203d219d0e1d16d71e908525825 Mon Sep 17 00:00:00 2001 From: Marti Raudsepp Date: Thu, 9 May 2024 13:59:32 +0300 Subject: [PATCH] Revert this part, it only works with DRF 3.15+ --- rest_framework_nested/relations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest_framework_nested/relations.py b/rest_framework_nested/relations.py index c0aec97c..4ae0ed43 100644 --- a/rest_framework_nested/relations.py +++ b/rest_framework_nested/relations.py @@ -6,7 +6,7 @@ """ from __future__ import unicode_literals, annotations from functools import reduce # import reduce from functools for compatibility with python 3 -from typing import Any, TypeVar +from typing import Any, TypeVar, Generic from django.core.exceptions import ObjectDoesNotExist from django.db.models import Model @@ -18,7 +18,7 @@ T_Model = TypeVar('T_Model', bound=Model) -class NestedHyperlinkedRelatedField(HyperlinkedRelatedField[T_Model]): +class NestedHyperlinkedRelatedField(HyperlinkedRelatedField, Generic[T_Model]): lookup_field = 'pk' parent_lookup_kwargs = { 'parent_pk': 'parent__pk'