فهرست منبع

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

Jeremy Stretch 6 سال پیش
والد
کامیت
a0545568cd

+ 1 - 0
CHANGELOG.md

@@ -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
 * [#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
+* [#3514](https://github.com/netbox-community/netbox/issues/3514) - Label TextVar fields when rendering custom script forms
 
 v2.6.3 (2019-09-04)
 

+ 5 - 1
netbox/dcim/forms.py

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

+ 3 - 1
netbox/extras/forms.py

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

+ 3 - 0
netbox/secrets/forms.py

@@ -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. "
                           "Please note that passphrase-protected keys are not supported.",
         }
+        labels = {
+            'public_key': ''
+        }
 
     def clean_public_key(self):
         key = self.cleaned_data['public_key']

+ 1 - 1
netbox/templates/utilities/render_field.html

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

+ 2 - 2
netbox/utilities/forms.py

@@ -384,7 +384,7 @@ class CSVDataField(forms.CharField):
 
         self.strip = False
         if not self.label:
-            self.label = 'CSV Data'
+            self.label = ''
         if not self.initial:
             self.initial = ','.join(required_fields) + '\n'
         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.
     """
     widget = forms.Textarea
-    default_label = 'Comments'
+    default_label = ''
     # TODO: Port GFM syntax cheat sheet to internal documentation
     default_helptext = '<i class="fa fa-info-circle"></i> '\
                        '<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet" target="_blank">'\

+ 3 - 4
netbox/virtualization/forms.py

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