mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Select2 for custom fields
This commit is contained in:
@ -52,7 +52,7 @@ def get_custom_fields_for_model(content_type, filterable_only=False, bulk_edit=F
|
|||||||
else:
|
else:
|
||||||
initial = None
|
initial = None
|
||||||
field = forms.NullBooleanField(
|
field = forms.NullBooleanField(
|
||||||
required=cf.required, initial=initial, widget=forms.Select(choices=choices)
|
required=cf.required, initial=initial, widget=StaticSelect2(choices=choices)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Date
|
# Date
|
||||||
@ -71,7 +71,9 @@ def get_custom_fields_for_model(content_type, filterable_only=False, bulk_edit=F
|
|||||||
default_choice = cf.choices.get(value=initial).pk
|
default_choice = cf.choices.get(value=initial).pk
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
pass
|
pass
|
||||||
field = forms.TypedChoiceField(choices=choices, coerce=int, required=cf.required, initial=default_choice)
|
field = forms.TypedChoiceField(
|
||||||
|
choices=choices, coerce=int, required=cf.required, initial=default_choice, widget=StaticSelect2()
|
||||||
|
)
|
||||||
|
|
||||||
# URL
|
# URL
|
||||||
elif cf.type == CF_TYPE_URL:
|
elif cf.type == CF_TYPE_URL:
|
||||||
|
Reference in New Issue
Block a user