From 53e43f1bc0d072e37a580cfc8293d2a8548cdd3b 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 2767effb..fa6a15a0 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -527,7 +527,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