Skip to content

Commit b6d6dab

Browse files
committed
fix parent type for geo
1 parent be51468 commit b6d6dab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

api/types/type_geo.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Optional
22

3+
import strawberry
34
import strawberry_django
45
from strawberry import auto
56

@@ -13,4 +14,10 @@ class TypeGeo(BaseType):
1314
name: auto
1415
code: auto
1516
type: auto
16-
parent_id: Optional["TypeGeo"]
17+
18+
@strawberry.field(description="Parent geography")
19+
def parent_id(self) -> Optional["TypeGeo"]:
20+
"""Get parent geography."""
21+
if self.parent_id: # type: ignore
22+
return TypeGeo.from_django(self.parent_id) # type: ignore
23+
return None

0 commit comments

Comments
 (0)