Fixes #11694 - Remove obsolete SmallTextarea widget

This commit is contained in:
kkthxbye-code 2023-02-10 22:29:34 +01:00 committed by jeremystretch
parent 530c7434ed
commit 723c85b59a
10 changed files with 44 additions and 53 deletions

View File

@ -7,8 +7,7 @@ from ipam.models import ASN
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import ( from utilities.forms import (
add_blank_choice, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SmallTextarea, add_blank_choice, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, StaticSelect,
StaticSelect,
) )
__all__ = ( __all__ = (
@ -35,7 +34,7 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )
@ -63,7 +62,7 @@ class ProviderNetworkBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )
@ -125,7 +124,7 @@ class CircuitBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )

View File

@ -5,7 +5,7 @@ from core.choices import DataSourceTypeChoices
from core.models import * from core.models import *
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from utilities.forms import ( from utilities.forms import (
add_blank_choice, BulkEditNullBooleanSelect, CommentField, SmallTextarea, StaticSelect, add_blank_choice, BulkEditNullBooleanSelect, CommentField, StaticSelect,
) )
__all__ = ( __all__ = (
@ -30,7 +30,7 @@ class DataSourceBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )
parameters = forms.JSONField( parameters = forms.JSONField(

View File

@ -11,7 +11,7 @@ from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import ( from utilities.forms import (
add_blank_choice, BulkEditForm, BulkEditNullBooleanSelect, ColorField, CommentField, DynamicModelChoiceField, add_blank_choice, BulkEditForm, BulkEditNullBooleanSelect, ColorField, CommentField, DynamicModelChoiceField,
DynamicModelMultipleChoiceField, form_from_model, SmallTextarea, StaticSelect, SelectSpeedWidget, DynamicModelMultipleChoiceField, form_from_model, StaticSelect, SelectSpeedWidget,
) )
__all__ = ( __all__ = (
@ -138,7 +138,7 @@ class SiteBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -309,7 +309,7 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -345,7 +345,7 @@ class RackReservationBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -406,7 +406,7 @@ class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -441,7 +441,7 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -551,7 +551,7 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -594,7 +594,7 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -644,7 +644,7 @@ class CableBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -668,7 +668,7 @@ class VirtualChassisBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -714,7 +714,7 @@ class PowerPanelBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -776,7 +776,7 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )

View File

@ -12,7 +12,7 @@ from netbox.forms import NetBoxModelForm
from tenancy.forms import TenancyForm from tenancy.forms import TenancyForm
from utilities.forms import ( from utilities.forms import (
APISelect, add_blank_choice, BootstrapMixin, ClearableFileInput, CommentField, ContentTypeChoiceField, APISelect, add_blank_choice, BootstrapMixin, ClearableFileInput, CommentField, ContentTypeChoiceField,
DynamicModelChoiceField, DynamicModelMultipleChoiceField, JSONField, NumericArrayField, SelectWithPK, SmallTextarea, DynamicModelChoiceField, DynamicModelMultipleChoiceField, JSONField, NumericArrayField, SelectWithPK,
SlugField, StaticSelect, SelectSpeedWidget, SlugField, StaticSelect, SelectSpeedWidget,
) )
from virtualization.models import Cluster, ClusterGroup from virtualization.models import Cluster, ClusterGroup
@ -149,12 +149,12 @@ class SiteForm(TenancyForm, NetBoxModelForm):
'description', 'physical_address', 'shipping_address', 'latitude', 'longitude', 'comments', 'tags', 'description', 'physical_address', 'shipping_address', 'latitude', 'longitude', 'comments', 'tags',
) )
widgets = { widgets = {
'physical_address': SmallTextarea( 'physical_address': forms.Textarea(
attrs={ attrs={
'rows': 3, 'rows': 3,
} }
), ),
'shipping_address': SmallTextarea( 'shipping_address': forms.Textarea(
attrs={ attrs={
'rows': 3, 'rows': 3,
} }
@ -470,7 +470,7 @@ class PlatformForm(NetBoxModelForm):
'name', 'slug', 'manufacturer', 'napalm_driver', 'napalm_args', 'description', 'tags', 'name', 'slug', 'manufacturer', 'napalm_driver', 'napalm_args', 'description', 'tags',
] ]
widgets = { widgets = {
'napalm_args': SmallTextarea(), 'napalm_args': forms.Textarea(),
} }

View File

@ -10,7 +10,7 @@ from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import ( from utilities.forms import (
add_blank_choice, BulkEditNullBooleanSelect, CommentField, DynamicModelChoiceField, NumericArrayField, add_blank_choice, BulkEditNullBooleanSelect, CommentField, DynamicModelChoiceField, NumericArrayField,
SmallTextarea, StaticSelect, DynamicModelMultipleChoiceField, StaticSelect, DynamicModelMultipleChoiceField,
) )
__all__ = ( __all__ = (
@ -48,7 +48,7 @@ class VRFBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -69,7 +69,7 @@ class RouteTargetBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -116,7 +116,7 @@ class ASNBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -145,7 +145,7 @@ class AggregateBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -227,7 +227,7 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -266,7 +266,7 @@ class IPRangeBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -314,7 +314,7 @@ class IPAddressBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -359,7 +359,7 @@ class FHRPGroupBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -442,7 +442,7 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -474,7 +474,7 @@ class ServiceTemplateBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -504,7 +504,7 @@ class L2VPNBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )

View File

@ -2,7 +2,7 @@ from django import forms
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import * from tenancy.models import *
from utilities.forms import CommentField, DynamicModelChoiceField, SmallTextarea from utilities.forms import CommentField, DynamicModelChoiceField
__all__ = ( __all__ = (
'ContactBulkEditForm', 'ContactBulkEditForm',
@ -106,7 +106,7 @@ class ContactBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )

View File

@ -3,7 +3,7 @@ from django import forms
from netbox.forms import NetBoxModelForm from netbox.forms import NetBoxModelForm
from tenancy.models import * from tenancy.models import *
from utilities.forms import ( from utilities.forms import (
BootstrapMixin, CommentField, DynamicModelChoiceField, SlugField, SmallTextarea, StaticSelect, BootstrapMixin, CommentField, DynamicModelChoiceField, SlugField, StaticSelect,
) )
__all__ = ( __all__ = (
@ -112,7 +112,7 @@ class ContactForm(NetBoxModelForm):
'group', 'name', 'title', 'phone', 'email', 'address', 'link', 'description', 'comments', 'tags', 'group', 'name', 'title', 'phone', 'email', 'address', 'link', 'description', 'comments', 'tags',
) )
widgets = { widgets = {
'address': SmallTextarea(attrs={'rows': 3}), 'address': forms.Textarea(attrs={'rows': 3}),
} }

View File

@ -21,7 +21,6 @@ __all__ = (
'SelectSpeedWidget', 'SelectSpeedWidget',
'SelectWithPK', 'SelectWithPK',
'SlugWidget', 'SlugWidget',
'SmallTextarea',
'StaticSelect', 'StaticSelect',
'StaticSelectMultiple', 'StaticSelectMultiple',
'TimePicker', 'TimePicker',
@ -33,13 +32,6 @@ QueryParam = Dict[str, QueryParamValue]
ProcessedParams = Sequence[Dict[str, Sequence[JSONPrimitive]]] ProcessedParams = Sequence[Dict[str, Sequence[JSONPrimitive]]]
class SmallTextarea(forms.Textarea):
"""
Subclass used for rendering a smaller textarea element.
"""
pass
class SlugWidget(forms.TextInput): class SlugWidget(forms.TextInput):
""" """
Subclass TextInput and add a slug regeneration button next to the form field. Subclass TextInput and add a slug regeneration button next to the form field.

View File

@ -9,7 +9,7 @@ from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import ( from utilities.forms import (
add_blank_choice, BulkEditNullBooleanSelect, BulkRenameForm, CommentField, DynamicModelChoiceField, add_blank_choice, BulkEditNullBooleanSelect, BulkRenameForm, CommentField, DynamicModelChoiceField,
DynamicModelMultipleChoiceField, SmallTextarea, StaticSelect DynamicModelMultipleChoiceField, StaticSelect
) )
from virtualization.choices import * from virtualization.choices import *
from virtualization.models import * from virtualization.models import *
@ -90,7 +90,7 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )
@ -163,7 +163,7 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label=_('Comments') label=_('Comments')
) )

View File

@ -5,7 +5,7 @@ from dcim.choices import LinkStatusChoices
from ipam.models import VLAN from ipam.models import VLAN
from netbox.forms import NetBoxModelBulkEditForm from netbox.forms import NetBoxModelBulkEditForm
from tenancy.models import Tenant from tenancy.models import Tenant
from utilities.forms import add_blank_choice, CommentField, DynamicModelChoiceField, SmallTextarea from utilities.forms import add_blank_choice, CommentField, DynamicModelChoiceField
from wireless.choices import * from wireless.choices import *
from wireless.constants import SSID_MAX_LENGTH from wireless.constants import SSID_MAX_LENGTH
from wireless.models import * from wireless.models import *
@ -74,7 +74,7 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )
@ -119,7 +119,7 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm):
required=False required=False
) )
comments = CommentField( comments = CommentField(
widget=SmallTextarea, widget=forms.Textarea,
label='Comments' label='Comments'
) )