From 662cafe416b7dd0ed2a23735453131a3361d931d Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 4 Jan 2022 15:01:16 -0500 Subject: [PATCH] Form widgets & style cleanup --- netbox/extras/forms/models.py | 18 ++++++++++++++---- netbox/ipam/forms/models.py | 3 +-- netbox/project-static/dist/netbox-light.css | Bin 493807 -> 493807 bytes netbox/project-static/dist/netbox-print.css | Bin 1624275 -> 1624275 bytes netbox/project-static/styles/theme-light.scss | 2 -- netbox/utilities/forms/fields.py | 4 ++-- netbox/utilities/forms/widgets.py | 10 ---------- .../templates/widgets/select_contenttype.html | 1 - 8 files changed, 17 insertions(+), 21 deletions(-) delete mode 100644 netbox/utilities/templates/widgets/select_contenttype.html diff --git a/netbox/extras/forms/models.py b/netbox/extras/forms/models.py index 1e619ebec..89ab7aa19 100644 --- a/netbox/extras/forms/models.py +++ b/netbox/extras/forms/models.py @@ -7,8 +7,8 @@ from extras.models import * from extras.utils import FeatureQuery from tenancy.models import Tenant, TenantGroup from utilities.forms import ( - add_blank_choice, BootstrapMixin, CommentField, ContentTypeChoiceField, - ContentTypeMultipleChoiceField, DynamicModelMultipleChoiceField, JSONField, SlugField, StaticSelect, + add_blank_choice, BootstrapMixin, CommentField, ContentTypeChoiceField, ContentTypeMultipleChoiceField, + DynamicModelMultipleChoiceField, JSONField, SlugField, StaticSelect, ) from virtualization.models import Cluster, ClusterGroup @@ -41,6 +41,10 @@ class CustomFieldForm(BootstrapMixin, forms.ModelForm): ('Values', ('default', 'choices')), ('Validation', ('validation_minimum', 'validation_maximum', 'validation_regex')), ) + widgets = { + 'type': StaticSelect(), + 'filter_logic': StaticSelect(), + } class CustomLinkForm(BootstrapMixin, forms.ModelForm): @@ -57,6 +61,7 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm): ('Templates', ('link_text', 'link_url')), ) widgets = { + 'button_class': StaticSelect(), 'link_text': forms.Textarea(attrs={'class': 'font-monospace'}), 'link_url': forms.Textarea(attrs={'class': 'font-monospace'}), } @@ -96,8 +101,7 @@ class WebhookForm(BootstrapMixin, forms.ModelForm): model = Webhook fields = '__all__' fieldsets = ( - ('Webhook', ('name', 'enabled')), - ('Assigned Models', ('content_types',)), + ('Webhook', ('name', 'content_types', 'enabled')), ('Events', ('type_create', 'type_update', 'type_delete')), ('HTTP Request', ( 'payload_url', 'http_method', 'http_content_type', 'additional_headers', 'body_template', 'secret', @@ -105,7 +109,13 @@ class WebhookForm(BootstrapMixin, forms.ModelForm): ('Conditions', ('conditions',)), ('SSL', ('ssl_verification', 'ca_file_path')), ) + labels = { + 'type_create': 'Creations', + 'type_update': 'Updates', + 'type_delete': 'Deletions', + } widgets = { + 'http_method': StaticSelect(), 'additional_headers': forms.Textarea(attrs={'class': 'font-monospace'}), 'body_template': forms.Textarea(attrs={'class': 'font-monospace'}), } diff --git a/netbox/ipam/forms/models.py b/netbox/ipam/forms/models.py index 0f85a95b1..4ed8aa267 100644 --- a/netbox/ipam/forms/models.py +++ b/netbox/ipam/forms/models.py @@ -628,8 +628,7 @@ class FHRPGroupAssignmentForm(BootstrapMixin, forms.ModelForm): class VLANGroupForm(CustomFieldModelForm): scope_type = ContentTypeChoiceField( queryset=ContentType.objects.filter(model__in=VLANGROUP_SCOPE_TYPES), - required=False, - widget=StaticSelect + required=False ) region = DynamicModelChoiceField( queryset=Region.objects.all(), diff --git a/netbox/project-static/dist/netbox-light.css b/netbox/project-static/dist/netbox-light.css index 23dc8d3821e58e7264fe4bd3109dea298dc227bf..215f986bb1045d51eac763de5aac1e0e23d59cad 100644 GIT binary patch delta 216 zcmaDqQSSXjxeaCU(-l^;vNzYpx7Wrq0x=U1GXpWp_S$$>{a}zR+jPZQtg_qBZ(`la z0pV}h#j3D<-ELM9Sunr-#0}Q%CvLFuWlf*2#>75d-kn`zngt{8IO;>eh z&j6{EoBm-3Gu!ly&g`=%C){V7yx|#~ezHT?Gh%8j3{lpE{?I&)q@nubyRbXPDF7M8+G0lRJck-Pu-pLc5vrSiZ zX3v1Covb)ZY`VY^W{&9_o!MtkE_li|IpG=4Ous$nGgAqiZrAn19hVSGEoqP#9W4+Fn1+^l>(*E>Z1V|Sfv3G&(rzdza(bU2voPJ zE{=BSZvL++nr44FRi`M7EYu@Xb#^cYMpjW^q3)qjSmZKHncRZh4-132s6`K}eAdYY z6==OP6>2JvLiN;Z!1uUhkkY!Hw2N^5!M4Dhp;2f~>qN|avK5Kg6L#8Ohi02a;P#Se z;_{0|toA-0$X(|GtRJEO_bSOHlQC2s9MFBwjWCbny#O CaFav; delta 438 zcmZ9`JxD@P7zSX}+qrtZH?JP;9PEcef()XX`f;#=gixp^8wE4kifC$TiN*?vcZ)kU zH53$QNt%o3hn5HeA)F#;h=zWw&!~uoXZXGsUf!#X{MAN&dEYgZWQBo3zA&?zO1g-f zc!);o2qQZ25+5;$pP0lV^&~)S5+os&O7b1?U5d#Z=O{Px09vPbK*h6stnnvno90nC z^W0Qh3w$w)5gu$`?K|NlOd_N~^__^7Zk)H;41*Ojj9gl3NZ2xhi4PHmo%XkEI&!o) z5!6wB76x_=*#c+JW8uBmWg(Z<84g~=EY@$#COF*ks^M2L>B8K#o8h7=qBt!vzbd_n z`>$tQT~@`D_M4Am_sA1MPm!6bUz5ig)~?;YVl2l0jLB7njU_``*w$nx&JF2Bmm!;r wJs}30$#^YnuU)jZ180Wx)$-fgJ{^gQ`L8U3hdP;oconsole server port - This attribute can be used to reference the relevant API endpoint for a particular ContentType. - """ - option_template_name = 'widgets/select_contenttype.html' - - class SelectSpeedWidget(forms.NumberInput): """ Speed field with dropdown selections for convenience. diff --git a/netbox/utilities/templates/widgets/select_contenttype.html b/netbox/utilities/templates/widgets/select_contenttype.html deleted file mode 100644 index 04c42c371..000000000 --- a/netbox/utilities/templates/widgets/select_contenttype.html +++ /dev/null @@ -1 +0,0 @@ -