reservations: Don't error out when Reservation.resources not yet ready
All checks were successful
Ruff / ruff (push) Successful in 43s
Test / test (push) Successful in 6m42s

This commit is contained in:
Adam Goldsmith 2024-12-30 13:33:51 -05:00
parent b3a7ef8232
commit bccbc04f87

View File

@ -101,7 +101,10 @@ class Reservation(models.Model):
] ]
def __str__(self) -> str: 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}" return f"{resources}: {self.start} - {self.end}"
def __repr__(self) -> str: def __repr__(self) -> str: