Repository: nautobot/nautobot

Issue:
1.2 Homepage object counts for DCIM all point to Rack model
<!--
    NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED.

    This form is only for reporting reproducible bugs. If you need assistance
    with Nautobot installation, or if you have a general question, please start a
    discussion instead: https://github.com/nautobot/nautobot/discussions

    Please describe the environment in which you are running Nautobot. Be sure
    that you are running an unmodified instance of the latest stable release
    before submitting a bug report, and that any plugins have been disabled.
-->
### Environment
* Python version: 3.9
* Nautobot version: 1.2.0-alpha1

<!--
    Describe in detail the exact steps that someone else can take to reproduce
    this bug using the current stable release of Nautobot. Begin with the
    creation of any necessary database objects and call out every operation
    being performed explicitly. If reporting a bug in the REST API, be sure to
    reconstruct the raw HTTP request(s) being made: Don't rely on a client
    library such as pynautobot.
-->
### Steps to Reproduce
1. Create a set of each DCIM object which is listed on the homepage, like devices, interfaces, etc., and exactly 1 Rack
2. Navigate to the home page

<!-- What did you expect to happen? -->
### Expected Behavior
The home page widgets for object counts for DCIM should list correct counts for each object type.

<!-- What happened instead? -->
### Observed Behavior
Other than sites, all other DCIM object counts show the number of racks (in this case, exactly 1).


Discussion:

Resolving patch:
diff --git a/nautobot/dcim/homepage.py b/nautobot/dcim/homepage.py
--- a/nautobot/dcim/homepage.py
+++ b/nautobot/dcim/homepage.py
@@ -1,6 +1,5 @@
-from nautobot.dcim.models.power import PowerFeed, PowerPanel
-from nautobot.dcim.models import Cable, ConsolePort, Interface, PowerOutlet, Rack, Site
 from nautobot.core.apps import HomePageGroup, HomePageItem, HomePagePanel
+from nautobot.dcim import models
 
 
 layout = (
@@ -11,7 +10,7 @@
             HomePageItem(
                 name="Sites",
                 link="dcim:site_list",
-                model=Site,
+                model=models.Site,
                 description="Geographic location",
                 permissions=["dcim.view_site"],
                 weight=100,
@@ -25,7 +24,7 @@
             HomePageItem(
                 name="Racks",
                 link="dcim:rack_list",
-                model=Rack,
+                model=models.Rack,
                 description="Equipment racks, optionally organized by group",
                 permissions=["dcim.view_rack"],
                 weight=100,
@@ -33,7 +32,7 @@
             HomePageItem(
                 name="Device Types",
                 link="dcim:devicetype_list",
-                model=Rack,
+                model=models.DeviceType,
                 description="Physical hardware models by manufacturer",
                 permissions=["dcim.view_devicetype"],
                 weight=200,
@@ -41,7 +40,7 @@
             HomePageItem(
                 name="Devices",
                 link="dcim:device_list",
-                model=Rack,
+                model=models.Device,
                 description="Rack-mounted network equipment, servers, and other devices",
                 permissions=["dcim.view_device"],
                 weight=300,
@@ -49,7 +48,7 @@
             HomePageItem(
                 name="Virtual Chassis",
                 link="dcim:virtualchassis_list",
-                model=Rack,
+                model=models.VirtualChassis,
                 permissions=["dcim.view_virtualchassis"],
                 description="Represents a set of devices which share a common control plane",
                 weight=400,
@@ -61,28 +60,28 @@
                     HomePageItem(
                         name="Cables",
                         link="dcim:cable_list",
-                        model=Cable,
+                        model=models.Cable,
                         permissions=["dcim.view_cable"],
                         weight=100,
                     ),
                     HomePageItem(
                         name="Interfaces",
                         link="dcim:interface_connections_list",
-                        model=Interface,
+                        model=models.Interface,
                         permissions=["dcim.view_interface"],
                         weight=200,
                     ),
                     HomePageItem(
                         name="Console",
                         link="dcim:console_connections_list",
-                        model=ConsolePort,
+                        model=models.ConsolePort,
                         permissions=["dcim.view_consoleport", "dcim.view_consoleserverport"],
                         weight=300,
                     ),
                     HomePageItem(
                         name="Power",
                         link="dcim:power_connections_list",
-                        model=PowerOutlet,
+                        model=models.PowerOutlet,
                         permissions=["dcim.view_powerport", "dcim.view_poweroutlet"],
                         weight=400,
                     ),
@@ -97,7 +96,7 @@
             HomePageItem(
                 name="Power Feeds",
                 link="dcim:powerfeed_list",
-                model=PowerFeed,
+                model=models.PowerFeed,
                 description="Electrical circuits delivering power from panels",
                 permissions=["dcim.view_powerfeed"],
                 weight=100,
@@ -105,7 +104,7 @@
             HomePageItem(
                 name="Power Panels",
                 link="dcim:powerpanel_list",
-                model=PowerPanel,
+                model=models.PowerPanel,
                 description="Electrical panels receiving utility power",
                 permissions=["dcim.view_powerpanel"],
                 weight=200,


Test patch: