File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 1818 TypeCollaborativeOrganizationRelationship ,
1919)
2020from api .types .type_dataset import TypeDataset , TypeTag
21+ from api .types .type_geo import TypeGeo
2122from api .types .type_organization import TypeOrganization
2223from api .types .type_sdg import TypeSDG
2324from api .types .type_sector import TypeSector
@@ -71,6 +72,17 @@ def is_individual_collaborative(self) -> bool:
7172 """Check if this collaborative is created by an individual user."""
7273 return self .organization is None
7374
75+ @strawberry .field (description = "Get geographies associated with this collaborative." )
76+ def geographies (self ) -> Optional [List [TypeGeo ]]:
77+ """Get geographies associated with this collaborative."""
78+ try :
79+ queryset = self .geographies .all () # type: ignore
80+ if not queryset .exists ():
81+ return []
82+ return TypeGeo .from_django_list (queryset )
83+ except Exception :
84+ return []
85+
7486 @strawberry .field (description = "Get datasets associated with this collaborative." )
7587 def datasets (self ) -> Optional [List ["TypeDataset" ]]:
7688 """Get datasets associated with this collaborative."""
Original file line number Diff line number Diff line change 44from strawberry import auto
55
66from api .models import Geography
7+ from api .types .base_type import BaseType
78
89
910@strawberry_django .type (Geography )
10- class TypeGeo :
11+ class TypeGeo (BaseType ):
12+ id : auto
1113 name : auto
1214 code : auto
1315 type : auto
You can’t perform that action at this time.
0 commit comments