From bccbc04f871c6ec9580eb764f2294e457aaa507f Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 30 Dec 2024 13:33:51 -0500 Subject: [PATCH] reservations: Don't error out when Reservation.resources not yet ready --- reservations/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reservations/models.py b/reservations/models.py index 1c25ad6..fa436c4 100644 --- a/reservations/models.py +++ b/reservations/models.py @@ -101,7 +101,10 @@ class Reservation(models.Model): ] def __str__(self) -> str: - resources = ", ".join(str(resource) for resource in self.resources.all()) + try: + resources = ", ".join(str(resource) for resource in self.resources.all()) + except ValueError: + resources = "no resources" return f"{resources}: {self.start} - {self.end}" def __repr__(self) -> str: