Skip to content

Commit

Permalink
Fix one issue
Browse files Browse the repository at this point in the history
  • Loading branch information
intgr committed Apr 23, 2024
1 parent 6cc4e04 commit f96ff39
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rest_framework_nested/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@
"""
from __future__ import unicode_literals
from functools import reduce # import reduce from functools for compatibility with python 3
from typing import Any, Union, TypeVar
from typing import Any, Generic, Union, TypeVar

import rest_framework.relations
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Model
from rest_framework.relations import ObjectValueError, ObjectTypeError
from rest_framework.relations import HyperlinkedRelatedField, ObjectValueError, ObjectTypeError
from rest_framework.exceptions import ValidationError
from rest_framework.request import Request


T_Model = TypeVar('T_Model', bound=Model)


class NestedHyperlinkedRelatedField(rest_framework.relations.HyperlinkedRelatedField[T_Model]):
class NestedHyperlinkedRelatedField(HyperlinkedRelatedField, Generic[T_Model]):
lookup_field = 'pk'
parent_lookup_kwargs = {
'parent_pk': 'parent__pk'
Expand Down

0 comments on commit f96ff39

Please sign in to comment.