diff --git a/pyproject.toml b/pyproject.toml index e8b4a81..e316422 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "strawberry-django-plus" -version = "2.4.0" +version = "2.4.1" description = "Enhanced Strawberry GraphQL integration with Django" authors = ["Thiago Bellini Ribeiro "] license = "MIT" diff --git a/strawberry_django_plus/type.py b/strawberry_django_plus/type.py index 3e5c80f..58408df 100644 --- a/strawberry_django_plus/type.py +++ b/strawberry_django_plus/type.py @@ -327,6 +327,13 @@ def _process_type( cls, ) + # Adjust types that inherit from other types/interfaces that implement Node + # to make sure they pass themselves as the node type + for attr in ["resolve_node", "resolve_nodes", "resolve_id"]: + meth = getattr(cls, attr) + if isinstance(meth, types.MethodType) and meth.__self__ is not cls: + setattr(cls, attr, types.MethodType(cast(classmethod, meth).__func__, cls)) + strawberry.type(cls, **kwargs) # restore original annotations for further use