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'