Fixes #3514: Label TextVar fields when rendering custom script forms

This commit is contained in:
Jeremy Stretch 2019-09-18 15:39:26 -04:00
parent 84208d5429
commit a0545568cd
7 changed files with 18 additions and 9 deletions

View File

@ -14,6 +14,7 @@ v2.6.4 (FUTURE)
* [#3501](https://github.com/netbox-community/netbox/issues/3501) - Fix rendering of checkboxes on custom script forms * [#3501](https://github.com/netbox-community/netbox/issues/3501) - Fix rendering of checkboxes on custom script forms
* [#3511](https://github.com/netbox-community/netbox/issues/3511) - Correct API URL for nested device bays * [#3511](https://github.com/netbox-community/netbox/issues/3511) - Correct API URL for nested device bays
* [#3513](https://github.com/netbox-community/netbox/issues/3513) - Fix assignment of tags when creating front/rear ports * [#3513](https://github.com/netbox-community/netbox/issues/3513) - Fix assignment of tags when creating front/rear ports
* [#3514](https://github.com/netbox-community/netbox/issues/3514) - Label TextVar fields when rendering custom script forms
v2.6.3 (2019-09-04) v2.6.3 (2019-09-04)

View File

@ -809,6 +809,7 @@ class DeviceTypeForm(BootstrapMixin, CustomFieldForm):
slug = SlugField( slug = SlugField(
slug_source='model' slug_source='model'
) )
comments = CommentField()
tags = TagField( tags = TagField(
required=False required=False
) )
@ -1358,7 +1359,10 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldForm):
) )
comments = CommentField() comments = CommentField()
tags = TagField(required=False) tags = TagField(required=False)
local_context_data = JSONField(required=False) local_context_data = JSONField(
required=False,
label=''
)
class Meta: class Meta:
model = Device model = Device

View File

@ -241,7 +241,9 @@ class TagBulkEditForm(BootstrapMixin, BulkEditForm):
# #
class ConfigContextForm(BootstrapMixin, forms.ModelForm): class ConfigContextForm(BootstrapMixin, forms.ModelForm):
data = JSONField() data = JSONField(
label=''
)
class Meta: class Meta:
model = ConfigContext model = ConfigContext

View File

@ -199,6 +199,9 @@ class UserKeyForm(BootstrapMixin, forms.ModelForm):
'public_key': "Enter your public RSA key. Keep the private one with you; you'll need it for decryption. " 'public_key': "Enter your public RSA key. Keep the private one with you; you'll need it for decryption. "
"Please note that passphrase-protected keys are not supported.", "Please note that passphrase-protected keys are not supported.",
} }
labels = {
'public_key': ''
}
def clean_public_key(self): def clean_public_key(self):
key = self.cleaned_data['public_key'] key = self.cleaned_data['public_key']

View File

@ -24,7 +24,7 @@
</ul> </ul>
{% endif %} {% endif %}
</div> </div>
{% elif field|widget_type == 'textarea' %} {% elif field|widget_type == 'textarea' and not field.label %}
<div class="col-md-12"> <div class="col-md-12">
{{ field }} {{ field }}
{% if bulk_nullable %} {% if bulk_nullable %}

View File

@ -384,7 +384,7 @@ class CSVDataField(forms.CharField):
self.strip = False self.strip = False
if not self.label: if not self.label:
self.label = 'CSV Data' self.label = ''
if not self.initial: if not self.initial:
self.initial = ','.join(required_fields) + '\n' self.initial = ','.join(required_fields) + '\n'
if not self.help_text: if not self.help_text:
@ -484,7 +484,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' default_label = ''
# 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">'\

View File

@ -79,9 +79,7 @@ class ClusterGroupCSVForm(forms.ModelForm):
# #
class ClusterForm(BootstrapMixin, CustomFieldForm): class ClusterForm(BootstrapMixin, CustomFieldForm):
comments = CommentField( comments = CommentField()
widget=SmallTextarea()
)
tags = TagField( tags = TagField(
required=False required=False
) )
@ -331,7 +329,8 @@ class VirtualMachineForm(BootstrapMixin, TenancyForm, CustomFieldForm):
required=False required=False
) )
local_context_data = JSONField( local_context_data = JSONField(
required=False required=False,
label=''
) )
class Meta: class Meta: