diff --git a/netbox/netbox/views/__init__.py b/netbox/netbox/views/__init__.py index bc1a68569..66f66cf52 100644 --- a/netbox/netbox/views/__init__.py +++ b/netbox/netbox/views/__init__.py @@ -109,12 +109,13 @@ class HomeView(View): for section_label, section_items in sections: stat = {"label": section_label, "items": []} for perm, item_label, description, get_count in section_items: + app, scope = perm.split(".") + url = ":".join((app, scope.replace("view_", "") + "_list")) + item = {"label": item_label, "description": description, "count": None, "url": url, "disabled": True} if perm in perms: - app, scope = perm.split(".") - url = ":".join((app, scope.replace("view_", "") + "_list")) - stat["items"].append( - {"label": item_label, "description": description, "count": get_count(), "url": url} - ) + item["count"] = get_count() + item["disabled"] = False + stat["items"].append(item) stats.append(stat) return stats diff --git a/netbox/templates/home.html b/netbox/templates/home.html index 40d0f8c7e..c77e241ef 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -13,7 +13,7 @@
{% for item in section.items %} - +
{{ item.label }}
@@ -21,7 +21,13 @@ {{ item.description }} {% endif %}
- {{ item.count }} + + {% if item.count == None %} + + {% else %} + {{ item.count }} + {% endif %} +
{% endfor %}