From 289d62b86f4ad177a32ba22e19809cc6f515f7c3 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 11 Jun 2024 12:21:13 +0700 Subject: [PATCH] fix: allow usage of non-db fields --- basxbread/views/read.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/basxbread/views/read.py b/basxbread/views/read.py index ae36fa46..bce1d39f 100644 --- a/basxbread/views/read.py +++ b/basxbread/views/read.py @@ -26,6 +26,12 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def get_layout(self): + def get_helptext(f): + try: + return self.model._meta.get_field(field).help_text + except Exception: + return "" + return hg.DIV( header(), _layout.tile.Tile( @@ -47,7 +53,7 @@ def get_layout(self): hg.DIV( _layout.ObjectFieldLabel(field), _layout.forms.helpers.HelpText( - self.model._meta.get_field(field).help_text + get_helptext(field) ), ), ),