Przeglądaj źródła

Fixes #8425 - Fix exception when viewing change list/records with removed plugins

Daniel Sheppard 4 lat temu
rodzic
commit
ea283365e7

+ 1 - 0
docs/release-notes/version-3.1.md

@@ -16,6 +16,7 @@
 ### Bug Fixes
 ### Bug Fixes
 
 
 * [#8377](https://github.com/netbox-community/netbox/issues/8377) - Fix calculation of absolute cable lengths when specified in fractional units
 * [#8377](https://github.com/netbox-community/netbox/issues/8377) - Fix calculation of absolute cable lengths when specified in fractional units
+* [#8425](https://github.com/netbox-community/netbox/issues/8425) - Fix exception when viewing change list/records with removed plugins
 * [#8456](https://github.com/netbox-community/netbox/issues/8456) - Fix redundant display of VRF RD in prefix view
 * [#8456](https://github.com/netbox-community/netbox/issues/8456) - Fix redundant display of VRF RD in prefix view
 * [#8465](https://github.com/netbox-community/netbox/issues/8465) - Accept empty string values for Interface `rf_channel` in REST API
 * [#8465](https://github.com/netbox-community/netbox/issues/8465) - Accept empty string values for Interface `rf_channel` in REST API
 * [#8499](https://github.com/netbox-community/netbox/issues/8499) - Content types REST API endpoint should not require model permission
 * [#8499](https://github.com/netbox-community/netbox/issues/8499) - Content types REST API endpoint should not require model permission

+ 1 - 1
netbox/extras/tables.py

@@ -30,7 +30,7 @@ CONFIGCONTEXT_ACTIONS = """
 """
 """
 
 
 OBJECTCHANGE_OBJECT = """
 OBJECTCHANGE_OBJECT = """
-{% if record.changed_object.get_absolute_url %}
+{% if record.changed_object and record.changed_object.get_absolute_url %}
     <a href="{{ record.changed_object.get_absolute_url }}">{{ record.object_repr }}</a>
     <a href="{{ record.changed_object.get_absolute_url }}">{{ record.object_repr }}</a>
 {% else %}
 {% else %}
     {{ record.object_repr }}
     {{ record.object_repr }}

+ 6 - 4
netbox/templates/extras/objectchange.html

@@ -5,12 +5,14 @@
 
 
 {% block breadcrumbs %}
 {% block breadcrumbs %}
   <li class="breadcrumb-item"><a href="{% url 'extras:objectchange_list' %}">Change Log</a></li>
   <li class="breadcrumb-item"><a href="{% url 'extras:objectchange_list' %}">Change Log</a></li>
-  {% if object.related_object.get_absolute_url %}
+  {% if object.related_object and object.related_object.get_absolute_url %}
     <li class="breadcrumb-item"><a href="{{ object.related_object.get_absolute_url }}changelog/">{{ object.related_object }}</a></li>
     <li class="breadcrumb-item"><a href="{{ object.related_object.get_absolute_url }}changelog/">{{ object.related_object }}</a></li>
-  {% elif object.changed_object.get_absolute_url %}
+  {% elif object.changed_object and object.changed_object.get_absolute_url %}
     <li class="breadcrumb-item"><a href="{{ object.changed_object.get_absolute_url }}changelog/">{{ object.changed_object }}</a></li>
     <li class="breadcrumb-item"><a href="{{ object.changed_object.get_absolute_url }}changelog/">{{ object.changed_object }}</a></li>
-  {% elif object.changed_object %}
+  {% elif object.changed_object and object.changed_object.get_display %}
     <li class="breadcrumb-item">{{ object.changed_object }}</li>
     <li class="breadcrumb-item">{{ object.changed_object }}</li>
+  {% else %}
+    <li class="breadcrumb-item">{{ object.object_repr }}</li>
   {% endif %}
   {% endif %}
 {% endblock %}
 {% endblock %}
 
 
@@ -54,7 +56,7 @@
                     <tr>
                     <tr>
                         <th scope="row">Object</th>
                         <th scope="row">Object</th>
                         <td>
                         <td>
-                            {% if object.changed_object.get_absolute_url %}
+                            {% if object.changed_object and object.changed_object.get_absolute_url %}
                                 <a href="{{ object.changed_object.get_absolute_url }}">{{ object.changed_object }}</a>
                                 <a href="{{ object.changed_object.get_absolute_url }}">{{ object.changed_object }}</a>
                             {% else %}
                             {% else %}
                                 {{ object.object_repr }}
                                 {{ object.object_repr }}