From e170b6fce6e61e6e3b08f01333df8d0f9a6219e3 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 11 Feb 2022 11:33:16 -0500 Subject: [PATCH] Use ContentTypeChoiceField for object_type --- netbox/extras/forms/models.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/netbox/extras/forms/models.py b/netbox/extras/forms/models.py index c391665b3..4c4246be0 100644 --- a/netbox/extras/forms/models.py +++ b/netbox/extras/forms/models.py @@ -27,12 +27,17 @@ __all__ = ( class CustomFieldForm(BootstrapMixin, forms.ModelForm): content_types = ContentTypeMultipleChoiceField( queryset=ContentType.objects.all(), - limit_choices_to=FeatureQuery('custom_fields') + limit_choices_to=FeatureQuery('custom_fields'), + label='Model(s)' + ) + object_type = ContentTypeChoiceField( + queryset=ContentType.objects.all(), + required=False, + help_text="Type of the related object (for object/multi-object fields only)" ) fieldsets = ( - ('Custom Field', ('name', 'label', 'type', 'object_type', 'weight', 'required', 'description')), - ('Assigned Models', ('content_types',)), + ('Custom Field', ('content_types', 'name', 'label', 'type', 'object_type', 'weight', 'required', 'description')), ('Behavior', ('filter_logic',)), ('Values', ('default', 'choices')), ('Validation', ('validation_minimum', 'validation_maximum', 'validation_regex')),