diff --git a/netbox/circuits/forms/bulk_edit.py b/netbox/circuits/forms/bulk_edit.py index e1fe6338d..0cb419b61 100644 --- a/netbox/circuits/forms/bulk_edit.py +++ b/netbox/circuits/forms/bulk_edit.py @@ -7,8 +7,8 @@ from ipam.models import ASN from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import Tenant from utilities.forms import ( - add_blank_choice, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SmallTextarea, - StaticSelect, + add_blank_choice, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, + SmallMarkdownWidget, StaticSelect, ) __all__ = ( @@ -35,7 +35,7 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label=_('Comments') ) @@ -63,7 +63,7 @@ class ProviderNetworkBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label=_('Comments') ) @@ -125,7 +125,7 @@ class CircuitBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label=_('Comments') ) diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 38fa55738..fff7ba4af 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -11,7 +11,7 @@ from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import Tenant from utilities.forms import ( add_blank_choice, BulkEditForm, BulkEditNullBooleanSelect, ColorField, CommentField, DynamicModelChoiceField, - DynamicModelMultipleChoiceField, form_from_model, SmallTextarea, StaticSelect, SelectSpeedWidget, + DynamicModelMultipleChoiceField, form_from_model, StaticSelect, SelectSpeedWidget, SmallMarkdownWidget ) __all__ = ( @@ -138,7 +138,7 @@ class SiteBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -309,7 +309,7 @@ class RackBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -345,7 +345,7 @@ class RackReservationBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -406,7 +406,7 @@ class DeviceTypeBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -441,7 +441,7 @@ class ModuleTypeBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -551,7 +551,7 @@ class DeviceBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -594,7 +594,7 @@ class ModuleBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -644,7 +644,7 @@ class CableBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -668,7 +668,7 @@ class VirtualChassisBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -714,7 +714,7 @@ class PowerPanelBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -776,7 +776,7 @@ class PowerFeedBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label=_('Comments') ) diff --git a/netbox/ipam/forms/bulk_edit.py b/netbox/ipam/forms/bulk_edit.py index d0af43975..a95db8d1d 100644 --- a/netbox/ipam/forms/bulk_edit.py +++ b/netbox/ipam/forms/bulk_edit.py @@ -10,7 +10,7 @@ from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import Tenant from utilities.forms import ( add_blank_choice, BulkEditNullBooleanSelect, CommentField, DynamicModelChoiceField, NumericArrayField, - SmallTextarea, StaticSelect, DynamicModelMultipleChoiceField, + StaticSelect, DynamicModelMultipleChoiceField, SmallMarkdownWidget ) __all__ = ( @@ -48,7 +48,7 @@ class VRFBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -69,7 +69,7 @@ class RouteTargetBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -116,7 +116,7 @@ class ASNBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -145,7 +145,7 @@ class AggregateBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -227,7 +227,7 @@ class PrefixBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -266,7 +266,7 @@ class IPRangeBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -314,7 +314,7 @@ class IPAddressBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -359,7 +359,7 @@ class FHRPGroupBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -442,7 +442,7 @@ class VLANBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -474,7 +474,7 @@ class ServiceTemplateBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -504,7 +504,7 @@ class L2VPNBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) diff --git a/netbox/tenancy/forms/bulk_edit.py b/netbox/tenancy/forms/bulk_edit.py index 183a8e851..bea5b4432 100644 --- a/netbox/tenancy/forms/bulk_edit.py +++ b/netbox/tenancy/forms/bulk_edit.py @@ -2,7 +2,7 @@ from django import forms from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import * -from utilities.forms import CommentField, DynamicModelChoiceField, SmallTextarea +from utilities.forms import CommentField, DynamicModelChoiceField, SmallMarkdownWidget __all__ = ( 'ContactBulkEditForm', @@ -106,7 +106,7 @@ class ContactBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) diff --git a/netbox/utilities/forms/widgets.py b/netbox/utilities/forms/widgets.py index ef574388d..88d44e86a 100644 --- a/netbox/utilities/forms/widgets.py +++ b/netbox/utilities/forms/widgets.py @@ -16,11 +16,13 @@ __all__ = ( 'ColorSelect', 'DatePicker', 'DateTimePicker', + 'MarkdownWidget', 'NumericArrayField', 'SelectDurationWidget', 'SelectSpeedWidget', 'SelectWithPK', 'SlugWidget', + 'SmallMarkdownWidget', 'SmallTextarea', 'StaticSelect', 'StaticSelectMultiple', @@ -120,6 +122,13 @@ class MarkdownWidget(forms.Textarea): template_name = 'widgets/markdown_input.html' +class SmallMarkdownWidget(MarkdownWidget): + """ + Subclass used for rendering a smaller markdown element. + """ + pass + + class NumericArrayField(SimpleArrayField): def clean(self, value): diff --git a/netbox/virtualization/forms/bulk_edit.py b/netbox/virtualization/forms/bulk_edit.py index 14ae89c37..86a12dbc2 100644 --- a/netbox/virtualization/forms/bulk_edit.py +++ b/netbox/virtualization/forms/bulk_edit.py @@ -9,7 +9,7 @@ from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import Tenant from utilities.forms import ( add_blank_choice, BulkEditNullBooleanSelect, BulkRenameForm, CommentField, DynamicModelChoiceField, - DynamicModelMultipleChoiceField, SmallTextarea, StaticSelect + DynamicModelMultipleChoiceField, StaticSelect, SmallMarkdownWidget ) from virtualization.choices import * from virtualization.models import * @@ -90,7 +90,7 @@ class ClusterBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label=_('Comments') ) @@ -163,7 +163,7 @@ class VirtualMachineBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label=_('Comments') ) diff --git a/netbox/wireless/forms/bulk_edit.py b/netbox/wireless/forms/bulk_edit.py index be54faf9e..889ff36aa 100644 --- a/netbox/wireless/forms/bulk_edit.py +++ b/netbox/wireless/forms/bulk_edit.py @@ -5,7 +5,7 @@ from dcim.choices import LinkStatusChoices from ipam.models import VLAN from netbox.forms import NetBoxModelBulkEditForm from tenancy.models import Tenant -from utilities.forms import add_blank_choice, CommentField, DynamicModelChoiceField, SmallTextarea +from utilities.forms import add_blank_choice, CommentField, DynamicModelChoiceField, SmallMarkdownWidget from wireless.choices import * from wireless.constants import SSID_MAX_LENGTH from wireless.models import * @@ -74,7 +74,7 @@ class WirelessLANBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' ) @@ -119,7 +119,7 @@ class WirelessLinkBulkEditForm(NetBoxModelBulkEditForm): required=False ) comments = CommentField( - widget=SmallTextarea, + widget=SmallMarkdownWidget, label='Comments' )