mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
Define default label for CommentField
This commit is contained in:
parent
d7d7353784
commit
22792fb992
@ -26,9 +26,7 @@ class ProviderForm(NetBoxModelForm):
|
|||||||
label=_('ASNs'),
|
label=_('ASNs'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Provider'), ('name', 'slug', 'asns', 'description', 'tags')),
|
(_('Provider'), ('name', 'slug', 'asns', 'description', 'tags')),
|
||||||
@ -46,9 +44,7 @@ class ProviderAccountForm(NetBoxModelForm):
|
|||||||
label=_('Provider'),
|
label=_('Provider'),
|
||||||
queryset=Provider.objects.all()
|
queryset=Provider.objects.all()
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ProviderAccount
|
model = ProviderAccount
|
||||||
@ -62,9 +58,7 @@ class ProviderNetworkForm(NetBoxModelForm):
|
|||||||
label=_('Provider'),
|
label=_('Provider'),
|
||||||
queryset=Provider.objects.all()
|
queryset=Provider.objects.all()
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Provider Network'), ('provider', 'name', 'service_id', 'description', 'tags')),
|
(_('Provider Network'), ('provider', 'name', 'service_id', 'description', 'tags')),
|
||||||
|
@ -18,9 +18,7 @@ __all__ = (
|
|||||||
|
|
||||||
|
|
||||||
class DataSourceForm(NetBoxModelForm):
|
class DataSourceForm(NetBoxModelForm):
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DataSource
|
model = DataSource
|
||||||
|
@ -132,9 +132,7 @@ class SiteForm(TenancyForm, NetBoxModelForm):
|
|||||||
choices=add_blank_choice(TimeZoneFormField().choices),
|
choices=add_blank_choice(TimeZoneFormField().choices),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Site'), (
|
(_('Site'), (
|
||||||
@ -227,9 +225,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
|||||||
queryset=RackRole.objects.all(),
|
queryset=RackRole.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Rack
|
model = Rack
|
||||||
@ -301,9 +297,7 @@ class DeviceTypeForm(NetBoxModelForm):
|
|||||||
label=_('Slug'),
|
label=_('Slug'),
|
||||||
slug_source='model'
|
slug_source='model'
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Device Type'), ('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags')),
|
(_('Device Type'), ('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags')),
|
||||||
@ -335,9 +329,7 @@ class ModuleTypeForm(NetBoxModelForm):
|
|||||||
label=_('Manufacturer'),
|
label=_('Manufacturer'),
|
||||||
queryset=Manufacturer.objects.all()
|
queryset=Manufacturer.objects.all()
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Module Type'), ('manufacturer', 'model', 'part_number', 'description', 'tags')),
|
(_('Module Type'), ('manufacturer', 'model', 'part_number', 'description', 'tags')),
|
||||||
@ -457,9 +449,7 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
|
|||||||
required=False,
|
required=False,
|
||||||
selector=True
|
selector=True
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
local_context_data = JSONField(
|
local_context_data = JSONField(
|
||||||
required=False,
|
required=False,
|
||||||
label=''
|
label=''
|
||||||
@ -577,9 +567,7 @@ class ModuleForm(ModuleCommonForm, NetBoxModelForm):
|
|||||||
queryset=ModuleType.objects.all(),
|
queryset=ModuleType.objects.all(),
|
||||||
selector=True
|
selector=True
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
replicate_components = forms.BooleanField(
|
replicate_components = forms.BooleanField(
|
||||||
label=_('Replicate components'),
|
label=_('Replicate components'),
|
||||||
required=False,
|
required=False,
|
||||||
@ -619,9 +607,7 @@ class ModuleForm(ModuleCommonForm, NetBoxModelForm):
|
|||||||
|
|
||||||
|
|
||||||
class CableForm(TenancyForm, NetBoxModelForm):
|
class CableForm(TenancyForm, NetBoxModelForm):
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Cable
|
model = Cable
|
||||||
@ -675,9 +661,7 @@ class PowerFeedForm(TenancyForm, NetBoxModelForm):
|
|||||||
required=False,
|
required=False,
|
||||||
selector=True
|
selector=True
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Power Feed'), ('power_panel', 'rack', 'name', 'status', 'type', 'description', 'mark_connected', 'tags')),
|
(_('Power Feed'), ('power_panel', 'rack', 'name', 'status', 'type', 'description', 'mark_connected', 'tags')),
|
||||||
@ -703,9 +687,7 @@ class VirtualChassisForm(NetBoxModelForm):
|
|||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = VirtualChassis
|
model = VirtualChassis
|
||||||
|
@ -438,9 +438,7 @@ class JournalEntryForm(NetBoxModelForm):
|
|||||||
choices=add_blank_choice(JournalEntryKindChoices),
|
choices=add_blank_choice(JournalEntryKindChoices),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = JournalEntry
|
model = JournalEntry
|
||||||
|
@ -55,9 +55,7 @@ class VRFForm(TenancyForm, NetBoxModelForm):
|
|||||||
queryset=RouteTarget.objects.all(),
|
queryset=RouteTarget.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('VRF'), ('name', 'rd', 'enforce_unique', 'description', 'tags')),
|
(_('VRF'), ('name', 'rd', 'enforce_unique', 'description', 'tags')),
|
||||||
@ -81,9 +79,7 @@ class RouteTargetForm(TenancyForm, NetBoxModelForm):
|
|||||||
('Route Target', ('name', 'description', 'tags')),
|
('Route Target', ('name', 'description', 'tags')),
|
||||||
('Tenancy', ('tenant_group', 'tenant')),
|
('Tenancy', ('tenant_group', 'tenant')),
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RouteTarget
|
model = RouteTarget
|
||||||
@ -113,9 +109,7 @@ class AggregateForm(TenancyForm, NetBoxModelForm):
|
|||||||
queryset=RIR.objects.all(),
|
queryset=RIR.objects.all(),
|
||||||
label=_('RIR')
|
label=_('RIR')
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Aggregate'), ('prefix', 'rir', 'date_added', 'description', 'tags')),
|
(_('Aggregate'), ('prefix', 'rir', 'date_added', 'description', 'tags')),
|
||||||
@ -160,9 +154,7 @@ class ASNForm(TenancyForm, NetBoxModelForm):
|
|||||||
label=_('Sites'),
|
label=_('Sites'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('ASN'), ('asn', 'rir', 'sites', 'description', 'tags')),
|
(_('ASN'), ('asn', 'rir', 'sites', 'description', 'tags')),
|
||||||
@ -230,9 +222,7 @@ class PrefixForm(TenancyForm, NetBoxModelForm):
|
|||||||
queryset=Role.objects.all(),
|
queryset=Role.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Prefix'), ('prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags')),
|
(_('Prefix'), ('prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags')),
|
||||||
@ -259,9 +249,7 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
|
|||||||
queryset=Role.objects.all(),
|
queryset=Role.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('IP Range'), ('vrf', 'start_address', 'end_address', 'role', 'status', 'mark_utilized', 'description', 'tags')),
|
(_('IP Range'), ('vrf', 'start_address', 'end_address', 'role', 'status', 'mark_utilized', 'description', 'tags')),
|
||||||
@ -676,9 +664,7 @@ class ServiceTemplateForm(NetBoxModelForm):
|
|||||||
),
|
),
|
||||||
help_text=_("Comma-separated list of one or more port numbers. A range may be specified using a hyphen.")
|
help_text=_("Comma-separated list of one or more port numbers. A range may be specified using a hyphen.")
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Service Template'), (
|
(_('Service Template'), (
|
||||||
@ -782,9 +768,7 @@ class L2VPNForm(TenancyForm, NetBoxModelForm):
|
|||||||
queryset=RouteTarget.objects.all(),
|
queryset=RouteTarget.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('L2VPN'), ('name', 'slug', 'type', 'identifier', 'description', 'tags')),
|
(_('L2VPN'), ('name', 'slug', 'type', 'identifier', 'description', 'tags')),
|
||||||
|
@ -48,9 +48,7 @@ class TenantForm(NetBoxModelForm):
|
|||||||
queryset=TenantGroup.objects.all(),
|
queryset=TenantGroup.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Tenant'), ('name', 'slug', 'group', 'description', 'tags')),
|
(_('Tenant'), ('name', 'slug', 'group', 'description', 'tags')),
|
||||||
@ -106,9 +104,7 @@ class ContactForm(NetBoxModelForm):
|
|||||||
queryset=ContactGroup.objects.all(),
|
queryset=ContactGroup.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Contact'), ('group', 'name', 'title', 'phone', 'email', 'address', 'link', 'description', 'tags')),
|
(_('Contact'), ('group', 'name', 'title', 'phone', 'email', 'address', 'link', 'description', 'tags')),
|
||||||
|
@ -26,14 +26,14 @@ class CommentField(forms.CharField):
|
|||||||
A textarea with support for Markdown rendering. Exists mostly just to add a standard `help_text`.
|
A textarea with support for Markdown rendering. Exists mostly just to add a standard `help_text`.
|
||||||
"""
|
"""
|
||||||
widget = widgets.MarkdownWidget
|
widget = widgets.MarkdownWidget
|
||||||
help_text = _("""
|
label = _('Comments')
|
||||||
<i class="mdi mdi-information-outline"></i>
|
help_text = _(
|
||||||
<a href="{url}" target="_blank" tabindex="-1">
|
'<i class="mdi mdi-information-outline"></i> '
|
||||||
Markdown</a> syntax is supported
|
'<a href="{url}" target="_blank" tabindex="-1">Markdown</a> syntax is supported'
|
||||||
""").format(url=static('docs/reference/markdown/'))
|
).format(url=static('docs/reference/markdown/'))
|
||||||
|
|
||||||
def __init__(self, *, help_text=help_text, required=False, **kwargs):
|
def __init__(self, *, label=label, help_text=help_text, required=False, **kwargs):
|
||||||
super().__init__(help_text=help_text, required=required, **kwargs)
|
super().__init__(label=label, help_text=help_text, required=required, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class SlugField(forms.SlugField):
|
class SlugField(forms.SlugField):
|
||||||
|
@ -74,9 +74,7 @@ class ClusterForm(TenancyForm, NetBoxModelForm):
|
|||||||
required=False,
|
required=False,
|
||||||
selector=True
|
selector=True
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Cluster'), ('name', 'type', 'group', 'site', 'status', 'description', 'tags')),
|
(_('Cluster'), ('name', 'type', 'group', 'site', 'status', 'description', 'tags')),
|
||||||
|
@ -48,9 +48,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
|
|||||||
selector=True,
|
selector=True,
|
||||||
label=_('VLAN')
|
label=_('VLAN')
|
||||||
)
|
)
|
||||||
comments = CommentField(
|
comments = CommentField()
|
||||||
label=_('Comments'),
|
|
||||||
)
|
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(_('Wireless LAN'), ('ssid', 'group', 'vlan', 'status', 'description', 'tags')),
|
(_('Wireless LAN'), ('ssid', 'group', 'vlan', 'status', 'description', 'tags')),
|
||||||
|
Loading…
Reference in New Issue
Block a user