Skip to content

Commit c90fb37

Browse files
Fixed issues where going to "Data Compliance" tab could potentially hide other tabs
1 parent 1339b37 commit c90fb37

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

changes/155.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed issues where going to "Data Compliance" tab could potentially hide other tabs.

nautobot_data_validation_engine/templates/nautobot_data_validation_engine/datacompliance_tab.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends 'generic/object_retrieve.html' %}
1+
{% extends base_template %}
22
{% load helpers %}
33
{% load tz %}
44
{% load static %}

nautobot_data_validation_engine/views.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from django.apps import apps as global_apps
44
from django.contrib.contenttypes.models import ContentType
5+
from django.template import TemplateDoesNotExist
6+
from django.template.loader import get_template
57
from django_tables2 import RequestConfig
68
from nautobot.core.views.viewsets import NautobotUIViewSet
79
from nautobot.core.views.generic import ObjectView
@@ -130,6 +132,16 @@ def get_extra_context(self, request, instance):
130132
)
131133
compliance_table = tables.DataComplianceTableTab(compliance_objects)
132134

135+
base_template = f"{instance._meta.app_label}/{instance._meta.model_name}.html"
136+
try:
137+
get_template(base_template)
138+
except TemplateDoesNotExist:
139+
base_template = f"{instance._meta.app_label}/{instance._meta.model_name}_retrieve.html"
140+
try:
141+
get_template(base_template)
142+
except TemplateDoesNotExist:
143+
base_template = "generic/object_retrieve.html"
144+
133145
paginate = {"paginator_class": EnhancedPaginator, "per_page": get_paginate_count(request)}
134146
RequestConfig(request, paginate).configure(compliance_table)
135-
return {"active_tab": request.GET["tab"], "table": compliance_table}
147+
return {"active_tab": request.GET["tab"], "table": compliance_table, "base_template": base_template}

tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def is_truthy(arg):
4848
namespace.configure(
4949
{
5050
"nautobot_data_validation_engine": {
51-
"nautobot_ver": "2.0.0",
51+
"nautobot_ver": "2.2.0",
5252
"project_name": "nautobot-data-validation-engine",
5353
"python_ver": "3.11",
5454
"local": False,

0 commit comments

Comments
 (0)