jeremystretch 4 лет назад
Родитель
Сommit
3203db07b7

+ 11 - 0
netbox/extras/forms.py

@@ -125,6 +125,10 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm):
             ('Custom Link', ('name', 'content_type', 'weight', 'group_name', 'button_class', 'new_window')),
             ('Templates', ('link_text', 'link_url')),
         )
+        widgets = {
+            'link_text': forms.Textarea(attrs={'class': 'font-monospace'}),
+            'link_url': forms.Textarea(attrs={'class': 'font-monospace'}),
+        }
         help_texts = {
             'link_text': 'Jinja2 template code for the link text. Reference the object as <code>{{ obj }}</code>. '
                          'Links which render as empty text will not be displayed.',
@@ -217,6 +221,9 @@ class ExportTemplateForm(BootstrapMixin, forms.ModelForm):
             ('Template', ('template_code',)),
             ('Rendering', ('mime_type', 'file_extension', 'as_attachment')),
         )
+        widgets = {
+            'template_code': forms.Textarea(attrs={'class': 'font-monospace'}),
+        }
 
 
 class ExportTemplateCSVForm(CSVModelForm):
@@ -316,6 +323,10 @@ class WebhookForm(BootstrapMixin, forms.ModelForm):
             )),
             ('SSL', ('ssl_verification', 'ca_file_path')),
         )
+        widgets = {
+            'additional_headers': forms.Textarea(attrs={'class': 'font-monospace'}),
+            'body_template': forms.Textarea(attrs={'class': 'font-monospace'}),
+        }
 
 
 class WebhookCSVForm(CSVModelForm):

+ 3 - 2
netbox/extras/models/models.py

@@ -91,7 +91,7 @@ class Webhook(ChangeLoggedModel):
         blank=True,
         help_text="User-supplied HTTP headers to be sent with the request in addition to the HTTP content type. "
                   "Headers should be defined in the format <code>Name: Value</code>. Jinja2 template processing is "
-                  "support with the same context as the request body (below)."
+                  "supported with the same context as the request body (below)."
     )
     body_template = models.TextField(
         blank=True,
@@ -249,7 +249,8 @@ class ExportTemplate(ChangeLoggedModel):
         blank=True
     )
     template_code = models.TextField(
-        help_text='The list of objects being exported is passed as a context variable named <code>queryset</code>.'
+        help_text='Jinja2 template code. The list of objects being exported is passed as a context variable named '
+                  '<code>queryset</code>.'
     )
     mime_type = models.CharField(
         max_length=50,

+ 12 - 3
netbox/extras/tables.py

@@ -103,9 +103,18 @@ class WebhookTable(BaseTable):
     )
     content_types = ContentTypesColumn()
     enabled = BooleanColumn()
-    type_create = BooleanColumn()
-    type_update = BooleanColumn()
-    type_delete = BooleanColumn()
+    type_create = BooleanColumn(
+        verbose_name='Create'
+    )
+    type_update = BooleanColumn(
+        verbose_name='Update'
+    )
+    type_delete = BooleanColumn(
+        verbose_name='Delete'
+    )
+    ssl_validation = BooleanColumn(
+        verbose_name='SSL Validation'
+    )
 
     class Meta(BaseTable.Meta):
         model = Webhook

+ 4 - 4
netbox/templates/extras/customlink.html

@@ -11,14 +11,14 @@
       </h5>
       <div class="card-body">
         <table class="table table-hover attr-table">
-          <tr>
-            <th scope="row">Content Type</th>
-            <td>{{ object.content_type }}</td>
-          </tr>
           <tr>
             <th scope="row">Name</th>
             <td>{{ object.name }}</td>
           </tr>
+          <tr>
+            <th scope="row">Content Type</th>
+            <td>{{ object.content_type }}</td>
+          </tr>
           <tr>
             <th scope="row">Group Name</th>
             <td>{{ object.group_name|placeholder }}</td>

+ 2 - 0
netbox/templates/extras/exporttemplate.html

@@ -2,6 +2,8 @@
 {% load helpers %}
 {% load plugins %}
 
+{% block title %}{{ object.name }}{% endblock %}
+
 {% block breadcrumbs %}
   {{ block.super }}
   <li class="breadcrumb-item"><a href="{% url 'extras:exporttemplate_list' %}?content_type={{ object.content_type.pk }}">{{ object.content_type }}</a></li>