converted over to using a class in disp.py that defines data about each variable in the form, and use an array of these objects to format the form in templates/index.html -- provides consistency of bootstrap classes and makes it far easier to move items around columns/rows in the future, e.g. when I resign. Also, now retrieve actual values form comparison set data (still have hardcoded cset_id for now), but also stopped using separate vars for items like CBA/TLS, and buried them into the finance_data

This commit is contained in:
2025-02-12 17:25:23 +11:00
parent af38b45034
commit 65ed02812a
5 changed files with 171 additions and 173 deletions

32
disp.py Normal file
View File

@@ -0,0 +1,32 @@
################################################################################
class FP:
def __repr__(self):
str=f"<{self.__class__.__name__}("
for k, v in self.__dict__.items():
if isinstance(v, (bytes, bytearray)):
str += f"{k}=<bytes>, "
elif k == "thumbnail":
str += f"{k}=<base64>, "
# skip internal state
elif k == "_sa_instance_state":
continue
else:
str += f"{k}={v!r}, "
str=str.rstrip(", ") + ")>"
return str
class FP_VAR(FP):
""" Var class is a simple 'struct' to keep data per variable to display
Created just to avoid using python list/dicts intermixed, and be able to consistently use
dot-notation of fields
"""
def __init__(self, label, varname, display='', cl='col-2', datevarname=''):
### Var Attributes -- note, simple class, no methods ###
self.label=label
self.varname=varname
self.display=display
self.cl=cl
self.datevarname=datevarname
return