2
0
Эх сурвалжийг харах

Clean up cable termination types

Jeremy Stretch 7 жил өмнө
parent
commit
63bd48003e

+ 2 - 0
netbox/dcim/forms.py

@@ -1851,6 +1851,8 @@ class CableCreateForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelForm):
         termination_a_type = self.instance.termination_a._meta.model_name
         termination_a_type = self.instance.termination_a._meta.model_name
         self.fields['termination_b_type'].queryset = ContentType.objects.filter(
         self.fields['termination_b_type'].queryset = ContentType.objects.filter(
             model__in=COMPATIBLE_TERMINATION_TYPES.get(termination_a_type)
             model__in=COMPATIBLE_TERMINATION_TYPES.get(termination_a_type)
+        ).exclude(
+            model='circuittermination'
         )
         )
 
 
 
 

+ 7 - 0
netbox/templates/dcim/cable_connect.html

@@ -1,5 +1,6 @@
 {% extends '_base.html' %}
 {% extends '_base.html' %}
 {% load static %}
 {% load static %}
+{% load helpers %}
 {% load form_helpers %}
 {% load form_helpers %}
 
 
 {% block content %}
 {% block content %}
@@ -49,6 +50,12 @@
                                     <p class="form-control-static">{{ termination_a.device }}</p>
                                     <p class="form-control-static">{{ termination_a.device }}</p>
                                 </div>
                                 </div>
                             </div>
                             </div>
+                            <div class="form-group">
+                                <label class="col-md-3 control-label required">Type</label>
+                                <div class="col-md-9">
+                                    <p class="form-control-static">{{ termination_a|model_name|capfirst }}</p>
+                                </div>
+                            </div>
                             <div class="form-group">
                             <div class="form-group">
                                 <label class="col-md-3 control-label required">Name</label>
                                 <label class="col-md-3 control-label required">Name</label>
                                 <div class="col-md-9">
                                 <div class="col-md-9">

+ 7 - 0
netbox/templates/dcim/inc/cable_termination.html

@@ -1,3 +1,4 @@
+{% load helpers %}
 <table class="table table-hover panel-body attr-table">
 <table class="table table-hover panel-body attr-table">
     {% if termination.device %}
     {% if termination.device %}
         {# Device component #}
         {# Device component #}
@@ -7,6 +8,12 @@
                 <a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
                 <a href="{{ termination.device.get_absolute_url }}">{{ termination.device }}</a>
             </td>
             </td>
         </tr>
         </tr>
+        <tr>
+            <td>Type</td>
+            <td>
+                {{ termination|model_name|capfirst }}
+            </td>
+        </tr>
         <tr>
         <tr>
             <td>Component</td>
             <td>Component</td>
             <td>{{ termination }}</td>
             <td>{{ termination }}</td>

+ 1 - 1
netbox/utilities/templates/widgets/select_contenttype.html

@@ -1 +1 @@
-<option value="{{ widget.value }}"{% include "django/forms/widgets/attrs.html" %}{% if widget.value %} api-value="{{ widget.label|slugify }}"{% endif %}>{{ widget.label.label|default:widget.label }}</option>
+<option value="{{ widget.value }}"{% include "django/forms/widgets/attrs.html" %}{% if widget.value %} api-value="{{ widget.label|slugify }}"{% endif %}>{{ widget.label.label|default:widget.label|capfirst }}</option>