1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

9856 temp checkin

This commit is contained in:
Arthur
2024-03-07 07:39:15 -08:00
parent 4784829477
commit 005a339745
2 changed files with 3 additions and 6 deletions

View File

@ -129,6 +129,7 @@ class CableTerminationType(NetBoxObjectType):
) )
class CableType(NetBoxObjectType): class CableType(NetBoxObjectType):
color: str color: str
tenant: Annotated["TenantType", strawberry.lazy('tenancy.graphql.types')] | None
@strawberry_django.field @strawberry_django.field
def terminations(self) -> List[CableTerminationType]: def terminations(self) -> List[CableTerminationType]:

View File

@ -472,25 +472,21 @@ class APIViewTestCases:
# this would require a fragment query # this would require a fragment query
continue continue
elif field.type is strawberry_django.fields.types.DjangoModelType: elif field.type is strawberry_django.fields.types.DjangoModelType:
print("")
print("")
print("DjangoModelType") print("DjangoModelType")
print("--------------------------") print("--------------------------")
print(f"{self.model} -> {field.name}") print(f"{self.model} -> {field.name}")
print("") print("")
# Dynamic fields must specify a subselection # Dynamic fields must specify a subselection
fields_string += f'{field.name} {{ id }}\n' fields_string += f'{field.name} {{ pk }}\n'
elif type(field.type) is StrawberryOptional: elif type(field.type) is StrawberryOptional:
if type(field.type.of_type) is LazyType: if type(field.type.of_type) is LazyType:
fields_string += f'{field.name} {{ id }}\n' fields_string += f'{field.name} {{ id }}\n'
elif field.type.of_type == strawberry_django.fields.types.DjangoModelType: elif field.type.of_type == strawberry_django.fields.types.DjangoModelType:
print("")
print("")
print("DjangoModelType") print("DjangoModelType")
print("--------------------------") print("--------------------------")
print(f"{self.model} -> {field.name}") print(f"{self.model} -> {field.name}")
print("") print("")
fields_string += f'{field.name} {{ id }}\n' fields_string += f'{field.name} {{ pk }}\n'
elif hasattr(field, 'is_relation') and field.is_relation: elif hasattr(field, 'is_relation') and field.is_relation:
# Note: StrawberryField types do not have is_relation # Note: StrawberryField types do not have is_relation
fields_string += f'{field.name} {{ id }}\n' fields_string += f'{field.name} {{ id }}\n'