mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 16:26:09 -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'),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Provider'), ('name', 'slug', 'asns', 'description', 'tags')),
|
||||
@ -46,9 +44,7 @@ class ProviderAccountForm(NetBoxModelForm):
|
||||
label=_('Provider'),
|
||||
queryset=Provider.objects.all()
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = ProviderAccount
|
||||
@ -62,9 +58,7 @@ class ProviderNetworkForm(NetBoxModelForm):
|
||||
label=_('Provider'),
|
||||
queryset=Provider.objects.all()
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Provider Network'), ('provider', 'name', 'service_id', 'description', 'tags')),
|
||||
|
@ -18,9 +18,7 @@ __all__ = (
|
||||
|
||||
|
||||
class DataSourceForm(NetBoxModelForm):
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = DataSource
|
||||
|
@ -132,9 +132,7 @@ class SiteForm(TenancyForm, NetBoxModelForm):
|
||||
choices=add_blank_choice(TimeZoneFormField().choices),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Site'), (
|
||||
@ -227,9 +225,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=RackRole.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = Rack
|
||||
@ -301,9 +297,7 @@ class DeviceTypeForm(NetBoxModelForm):
|
||||
label=_('Slug'),
|
||||
slug_source='model'
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Device Type'), ('manufacturer', 'model', 'slug', 'default_platform', 'description', 'tags')),
|
||||
@ -335,9 +329,7 @@ class ModuleTypeForm(NetBoxModelForm):
|
||||
label=_('Manufacturer'),
|
||||
queryset=Manufacturer.objects.all()
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Module Type'), ('manufacturer', 'model', 'part_number', 'description', 'tags')),
|
||||
@ -457,9 +449,7 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
|
||||
required=False,
|
||||
selector=True
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
local_context_data = JSONField(
|
||||
required=False,
|
||||
label=''
|
||||
@ -577,9 +567,7 @@ class ModuleForm(ModuleCommonForm, NetBoxModelForm):
|
||||
queryset=ModuleType.objects.all(),
|
||||
selector=True
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
replicate_components = forms.BooleanField(
|
||||
label=_('Replicate components'),
|
||||
required=False,
|
||||
@ -619,9 +607,7 @@ class ModuleForm(ModuleCommonForm, NetBoxModelForm):
|
||||
|
||||
|
||||
class CableForm(TenancyForm, NetBoxModelForm):
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = Cable
|
||||
@ -675,9 +661,7 @@ class PowerFeedForm(TenancyForm, NetBoxModelForm):
|
||||
required=False,
|
||||
selector=True
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Power Feed'), ('power_panel', 'rack', 'name', 'status', 'type', 'description', 'mark_connected', 'tags')),
|
||||
@ -703,9 +687,7 @@ class VirtualChassisForm(NetBoxModelForm):
|
||||
queryset=Device.objects.all(),
|
||||
required=False,
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = VirtualChassis
|
||||
|
@ -438,9 +438,7 @@ class JournalEntryForm(NetBoxModelForm):
|
||||
choices=add_blank_choice(JournalEntryKindChoices),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = JournalEntry
|
||||
|
@ -55,9 +55,7 @@ class VRFForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=RouteTarget.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('VRF'), ('name', 'rd', 'enforce_unique', 'description', 'tags')),
|
||||
@ -81,9 +79,7 @@ class RouteTargetForm(TenancyForm, NetBoxModelForm):
|
||||
('Route Target', ('name', 'description', 'tags')),
|
||||
('Tenancy', ('tenant_group', 'tenant')),
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
class Meta:
|
||||
model = RouteTarget
|
||||
@ -113,9 +109,7 @@ class AggregateForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=RIR.objects.all(),
|
||||
label=_('RIR')
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Aggregate'), ('prefix', 'rir', 'date_added', 'description', 'tags')),
|
||||
@ -160,9 +154,7 @@ class ASNForm(TenancyForm, NetBoxModelForm):
|
||||
label=_('Sites'),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('ASN'), ('asn', 'rir', 'sites', 'description', 'tags')),
|
||||
@ -230,9 +222,7 @@ class PrefixForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=Role.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Prefix'), ('prefix', 'status', 'vrf', 'role', 'is_pool', 'mark_utilized', 'description', 'tags')),
|
||||
@ -259,9 +249,7 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=Role.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('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.")
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Service Template'), (
|
||||
@ -782,9 +768,7 @@ class L2VPNForm(TenancyForm, NetBoxModelForm):
|
||||
queryset=RouteTarget.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('L2VPN'), ('name', 'slug', 'type', 'identifier', 'description', 'tags')),
|
||||
|
@ -48,9 +48,7 @@ class TenantForm(NetBoxModelForm):
|
||||
queryset=TenantGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Tenant'), ('name', 'slug', 'group', 'description', 'tags')),
|
||||
@ -106,9 +104,7 @@ class ContactForm(NetBoxModelForm):
|
||||
queryset=ContactGroup.objects.all(),
|
||||
required=False
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('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`.
|
||||
"""
|
||||
widget = widgets.MarkdownWidget
|
||||
help_text = _("""
|
||||
<i class="mdi mdi-information-outline"></i>
|
||||
<a href="{url}" target="_blank" tabindex="-1">
|
||||
Markdown</a> syntax is supported
|
||||
""").format(url=static('docs/reference/markdown/'))
|
||||
label = _('Comments')
|
||||
help_text = _(
|
||||
'<i class="mdi mdi-information-outline"></i> '
|
||||
'<a href="{url}" target="_blank" tabindex="-1">Markdown</a> syntax is supported'
|
||||
).format(url=static('docs/reference/markdown/'))
|
||||
|
||||
def __init__(self, *, help_text=help_text, required=False, **kwargs):
|
||||
super().__init__(help_text=help_text, required=required, **kwargs)
|
||||
def __init__(self, *, label=label, help_text=help_text, required=False, **kwargs):
|
||||
super().__init__(label=label, help_text=help_text, required=required, **kwargs)
|
||||
|
||||
|
||||
class SlugField(forms.SlugField):
|
||||
|
@ -74,9 +74,7 @@ class ClusterForm(TenancyForm, NetBoxModelForm):
|
||||
required=False,
|
||||
selector=True
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Cluster'), ('name', 'type', 'group', 'site', 'status', 'description', 'tags')),
|
||||
|
@ -48,9 +48,7 @@ class WirelessLANForm(TenancyForm, NetBoxModelForm):
|
||||
selector=True,
|
||||
label=_('VLAN')
|
||||
)
|
||||
comments = CommentField(
|
||||
label=_('Comments'),
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Wireless LAN'), ('ssid', 'group', 'vlan', 'status', 'description', 'tags')),
|
||||
|
Loading…
Reference in New Issue
Block a user