Skip to content

Commit

Permalink
Fixed issues where going to "Data Compliance" tab could potentially h…
Browse files Browse the repository at this point in the history
…ide other tabs
  • Loading branch information
itdependsnetworks committed Mar 30, 2024
1 parent 1339b37 commit c90fb37
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions changes/155.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed issues where going to "Data Compliance" tab could potentially hide other tabs.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends 'generic/object_retrieve.html' %}
{% extends base_template %}
{% load helpers %}
{% load tz %}
{% load static %}
Expand Down
14 changes: 13 additions & 1 deletion nautobot_data_validation_engine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from django.apps import apps as global_apps
from django.contrib.contenttypes.models import ContentType
from django.template import TemplateDoesNotExist
from django.template.loader import get_template
from django_tables2 import RequestConfig
from nautobot.core.views.viewsets import NautobotUIViewSet
from nautobot.core.views.generic import ObjectView
Expand Down Expand Up @@ -130,6 +132,16 @@ def get_extra_context(self, request, instance):
)
compliance_table = tables.DataComplianceTableTab(compliance_objects)

base_template = f"{instance._meta.app_label}/{instance._meta.model_name}.html"
try:
get_template(base_template)
except TemplateDoesNotExist:
base_template = f"{instance._meta.app_label}/{instance._meta.model_name}_retrieve.html"
try:
get_template(base_template)
except TemplateDoesNotExist:
base_template = "generic/object_retrieve.html"

paginate = {"paginator_class": EnhancedPaginator, "per_page": get_paginate_count(request)}
RequestConfig(request, paginate).configure(compliance_table)
return {"active_tab": request.GET["tab"], "table": compliance_table}
return {"active_tab": request.GET["tab"], "table": compliance_table, "base_template": base_template}
2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def is_truthy(arg):
namespace.configure(
{
"nautobot_data_validation_engine": {
"nautobot_ver": "2.0.0",
"nautobot_ver": "2.2.0",
"project_name": "nautobot-data-validation-engine",
"python_ver": "3.11",
"local": False,
Expand Down

0 comments on commit c90fb37

Please sign in to comment.