diff options
Diffstat (limited to 'jimbrella/admin.py')
-rw-r--r-- | jimbrella/admin.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/jimbrella/admin.py b/jimbrella/admin.py index 9a9f6c8..eaf0e54 100644 --- a/jimbrella/admin.py +++ b/jimbrella/admin.py @@ -72,9 +72,8 @@ def umbrellas_edit(): ]: data[key] = request.form.get(key) - error = None try: - db.update(data) + diff = db.update(data) except UmbrellaValueError as e: # invalid field is in `e.message`. return redirect( @@ -85,6 +84,19 @@ def umbrellas_edit(): except UmbrellaNotFoundError: pass # impossible on web console + for column, value_pair in diff.items(): + past, new = value_pair + admin_log.log( + "ADMIN_MODIFY_DB", + { + "admin_name": session["username"], + "serial": data["serial"], + "column": column, + "past_value": past, + "new_value": new, + }, + ) + return redirect(url_for("admin.umbrellas")) |