1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 01:16:10 +00:00

fix(appsettings): a group saves what was edited, all of it or none, in one row

- A group sent all its fields, and the ones left as they were undid
  what another administrator had saved meanwhile. Each field now sends
  the value the page showed, and only a field edited since is saved.
- A database error partway left the group half saved. The group is now
  saved in one transaction, written as one audit row: "Settings: change
  Console Scale to True, Console Clip Viewport to True".
This commit is contained in:
catborise 2026-10-25 23:20:28 +03:00
parent abd2dca8fa
commit bd3fb5f5df
4 changed files with 49 additions and 19 deletions

View file

@ -32,7 +32,7 @@ class SettingRowTests(TestCase):
self.client.post(self.url, {"BOOTSTRAP_THEME": theme})
self.client.post(self.url, {"BOOTSTRAP_THEME": theme}) # no change
self.assertEqual(rows(), [
(f"Setting {name}: change to 50", True, "-"),
(f"Settings: change {name} to 50", True, "-"),
(f"Setting Theme: change to {theme}", True, "-"),
])
@ -41,4 +41,4 @@ class SettingRowTests(TestCase):
with patch.object(AppSettings, "save", side_effect=DatabaseError("disk full")):
response = self.client.post(self.url, {"LOGS_PER_PAGE": "50"}, follow=True)
self.assertIn("error", [m.level_tag for m in response.context["messages"]])
self.assertEqual(rows(), [(f"Setting {name}: change to 50: DatabaseError", False, "-")])
self.assertEqual(rows(), [(f"Settings: change {name} to 50: DatabaseError", False, "-")])