mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #713: Include a label for the comments field when editing circuits, providers, or racks in bulk
This commit is contained in:
@ -54,7 +54,7 @@ class ProviderBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
|
|||||||
portal_url = forms.URLField(required=False, label='Portal')
|
portal_url = forms.URLField(required=False, label='Portal')
|
||||||
noc_contact = forms.CharField(required=False, widget=SmallTextarea, label='NOC contact')
|
noc_contact = forms.CharField(required=False, widget=SmallTextarea, label='NOC contact')
|
||||||
admin_contact = forms.CharField(required=False, widget=SmallTextarea, label='Admin contact')
|
admin_contact = forms.CharField(required=False, widget=SmallTextarea, label='Admin contact')
|
||||||
comments = CommentField()
|
comments = CommentField(widget=SmallTextarea)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'comments']
|
nullable_fields = ['asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'comments']
|
||||||
@ -183,7 +183,7 @@ class CircuitBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
|
|||||||
tenant = forms.ModelChoiceField(queryset=Tenant.objects.all(), required=False)
|
tenant = forms.ModelChoiceField(queryset=Tenant.objects.all(), required=False)
|
||||||
port_speed = forms.IntegerField(required=False, label='Port speed (Kbps)')
|
port_speed = forms.IntegerField(required=False, label='Port speed (Kbps)')
|
||||||
commit_rate = forms.IntegerField(required=False, label='Commit rate (Kbps)')
|
commit_rate = forms.IntegerField(required=False, label='Commit rate (Kbps)')
|
||||||
comments = CommentField()
|
comments = CommentField(widget=SmallTextarea)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['tenant', 'port_speed', 'commit_rate', 'comments']
|
nullable_fields = ['tenant', 'port_speed', 'commit_rate', 'comments']
|
||||||
|
@ -221,7 +221,7 @@ class RackBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
|
|||||||
type = forms.ChoiceField(choices=add_blank_choice(RACK_TYPE_CHOICES), required=False, label='Type')
|
type = forms.ChoiceField(choices=add_blank_choice(RACK_TYPE_CHOICES), required=False, label='Type')
|
||||||
width = forms.ChoiceField(choices=add_blank_choice(RACK_WIDTH_CHOICES), required=False, label='Width')
|
width = forms.ChoiceField(choices=add_blank_choice(RACK_WIDTH_CHOICES), required=False, label='Width')
|
||||||
u_height = forms.IntegerField(required=False, label='Height (U)')
|
u_height = forms.IntegerField(required=False, label='Height (U)')
|
||||||
comments = CommentField()
|
comments = CommentField(widget=SmallTextarea)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
nullable_fields = ['group', 'tenant', 'role', 'comments']
|
nullable_fields = ['group', 'tenant', 'role', 'comments']
|
||||||
|
@ -234,6 +234,7 @@ class CommentField(forms.CharField):
|
|||||||
A textarea with support for GitHub-Flavored Markdown. Exists mostly just to add a standard help_text.
|
A textarea with support for GitHub-Flavored Markdown. Exists mostly just to add a standard help_text.
|
||||||
"""
|
"""
|
||||||
widget = forms.Textarea
|
widget = forms.Textarea
|
||||||
|
default_label = 'Comments'
|
||||||
# TODO: Port GFM syntax cheat sheet to internal documentation
|
# TODO: Port GFM syntax cheat sheet to internal documentation
|
||||||
default_helptext = '<i class="fa fa-info-circle"></i> '\
|
default_helptext = '<i class="fa fa-info-circle"></i> '\
|
||||||
'<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">'\
|
'<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">'\
|
||||||
@ -241,8 +242,9 @@ class CommentField(forms.CharField):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
required = kwargs.pop('required', False)
|
required = kwargs.pop('required', False)
|
||||||
|
label = kwargs.pop('label', self.default_label)
|
||||||
help_text = kwargs.pop('help_text', self.default_helptext)
|
help_text = kwargs.pop('help_text', self.default_helptext)
|
||||||
super(CommentField, self).__init__(required=required, help_text=help_text, *args, **kwargs)
|
super(CommentField, self).__init__(required=required, label=label, help_text=help_text, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class FlexibleModelChoiceField(forms.ModelChoiceField):
|
class FlexibleModelChoiceField(forms.ModelChoiceField):
|
||||||
|
Reference in New Issue
Block a user