From 4ee689a802f9f3397e98bf4d131b575b37ffb09e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?= <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de> Date: Thu, 19 May 2022 19:46:14 +0200 Subject: [PATCH] Hide blank fields in string representation of ConstraintViolation This fixes #130 --- AKModel/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AKModel/models.py b/AKModel/models.py index 979f005f..6d17aab9 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -529,7 +529,7 @@ class ConstraintViolation(models.Model): # Stringify all other fields for field in self.fields: a = getattr(self, field, None) - if a is not None: + if a is not None and str(a) != '': output.append(f"{field}: {a}") return ", ".join(output) -- GitLab