mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fix parsing of extra_choices (#17691)
* Align strawberry resolver with expected return type * Align test data with expected representation of extra_choices in CustomFieldChoiceSet model --------- Co-authored-by: Griffin Ellis <griffin.ellis@pico.net>
This commit is contained in:
parent
2172ddde61
commit
ec89a9b106
@ -84,7 +84,7 @@ class CustomFieldType(ObjectType):
|
|||||||
class CustomFieldChoiceSetType(ObjectType):
|
class CustomFieldChoiceSetType(ObjectType):
|
||||||
|
|
||||||
choices_for: List[Annotated["CustomFieldType", strawberry.lazy('extras.graphql.types')]]
|
choices_for: List[Annotated["CustomFieldType", strawberry.lazy('extras.graphql.types')]]
|
||||||
extra_choices: List[str] | None
|
extra_choices: List[List[str]] | None
|
||||||
|
|
||||||
|
|
||||||
@strawberry_django.type(
|
@strawberry_django.type(
|
||||||
|
@ -244,9 +244,18 @@ class CustomFieldChoiceSetTest(APIViewTestCases.APIViewTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
choice_sets = (
|
choice_sets = (
|
||||||
CustomFieldChoiceSet(name='Choice Set 1', extra_choices=['1A', '1B', '1C', '1D', '1E']),
|
CustomFieldChoiceSet(
|
||||||
CustomFieldChoiceSet(name='Choice Set 2', extra_choices=['2A', '2B', '2C', '2D', '2E']),
|
name='Choice Set 1',
|
||||||
CustomFieldChoiceSet(name='Choice Set 3', extra_choices=['3A', '3B', '3C', '3D', '3E']),
|
extra_choices=[['1A', '1A'], ['1B', '1B'], ['1C', '1C'], ['1D', '1D'], ['1E', '1E']],
|
||||||
|
),
|
||||||
|
CustomFieldChoiceSet(
|
||||||
|
name='Choice Set 2',
|
||||||
|
extra_choices=[['2A', '2A'], ['2B', '2B'], ['2C', '2C'], ['2D', '2D'], ['2E', '2E']],
|
||||||
|
),
|
||||||
|
CustomFieldChoiceSet(
|
||||||
|
name='Choice Set 3',
|
||||||
|
extra_choices=[['3A', '3A'], ['3B', '3B'], ['3C', '3C'], ['3D', '3D'], ['3E', '3E']],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
CustomFieldChoiceSet.objects.bulk_create(choice_sets)
|
CustomFieldChoiceSet.objects.bulk_create(choice_sets)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user