From e8d1854dd6e7bebba9a2feb6cc22e985dd271a37 Mon Sep 17 00:00:00 2001 From: Andrew Dickinson Date: Sun, 2 Jun 2024 12:25:34 -0400 Subject: [PATCH] Fix node.buildings --- src/meshapi/models/node.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/meshapi/models/node.py b/src/meshapi/models/node.py index 7da7cf69..cf699506 100644 --- a/src/meshapi/models/node.py +++ b/src/meshapi/models/node.py @@ -1,12 +1,19 @@ -from typing import Any +from typing import TYPE_CHECKING, Any from django.core.validators import MaxValueValidator from django.db import models from meshapi.util.network_number import NETWORK_NUMBER_MAX, get_next_available_network_number +if TYPE_CHECKING: + # Gate the import to avoid cycles + from meshapi.models.building import Building + class Node(models.Model): + # This should be added automatically by django-stubs, but for some reason it's not :( + buildings: models.QuerySet["Building"] + class NodeStatus(models.TextChoices): INACTIVE = "Inactive" ACTIVE = "Active"