diff options
author | Frederick Yin <fkfd@fkfd.me> | 2021-10-31 17:03:19 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2021-10-31 17:13:01 +0800 |
commit | 7644830f34f3bd81d3b21b2d05710fbc91f20eb6 (patch) | |
tree | d20b89bacc2cec650e00d3f1e9ba68d8d699356b /jimbrella/admin_log.py | |
parent | 59c899e372a6d5e0309c585de43df015f775ebe7 (diff) |
Implement ADMIN_MODIFY_DB logs
When an admin requests /admin/umbrella/edit and the request succeeds, an
ADMIN_MODIFY_DB log is kept. `Database.update` will keep track of the
updated columns.
Diffstat (limited to 'jimbrella/admin_log.py')
-rw-r--r-- | jimbrella/admin_log.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/jimbrella/admin_log.py b/jimbrella/admin_log.py index 8b5bb09..622abec 100644 --- a/jimbrella/admin_log.py +++ b/jimbrella/admin_log.py @@ -106,7 +106,15 @@ class AdminLog: "{name} missed the due for umbrella #{key}. " + tenant_info ) elif event == "ADMIN_MODIFY_DB": - description = "{admin_name} changed {column} of umbrella #{serial} from {past_value} to {new_value}." + if not entry["past_value"]: + description = "{admin_name} set {column} of umbrella #{serial} to {new_value}." + elif not entry["new_value"]: + description = "{admin_name} cleared {column} of umbrella #{serial} (was {past_value})." + else: + description = ( + "{admin_name} changed {column} of umbrella #{serial} " + "from {past_value} to {new_value}." + ) friendly_logs.append( { |