Closes #19977: Denormalize device relationships on component models (#19984)

* Closes #19977: Denormalize site, location, and rack for device components

* Set blank=True on denormalized ForeignKeys

* Populate denormalized field in test data

* Ignore private fields when constructing test GraphQL requests
This commit is contained in:
Jeremy Stretch
2025-08-01 16:40:15 -04:00
committed by GitHub
parent 35b9d80819
commit aa9ee0e5c6
6 changed files with 546 additions and 25 deletions

View File

@@ -470,6 +470,9 @@ class APIViewTestCases:
elif type(field.type) is StrawberryOptional and type(field.type.of_type) is LazyType:
fields_string += f'{field.name} {{ id }}\n'
elif hasattr(field, 'is_relation') and field.is_relation:
# Ignore private fields
if field.name.startswith('_'):
continue
# Note: StrawberryField types do not have is_relation
fields_string += f'{field.name} {{ id }}\n'
elif inspect.isclass(field.type) and issubclass(field.type, IPAddressFamilyType):