mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(admin): a user or group form opened before another change does not undo it
The user and group edit forms send back every field they show. A form opened before another administrator blocked the user, took away a group or a permission, or changed a group's members, put those back when it was saved for another change. The forms now send a fingerprint of what they showed, and a user or group changed meanwhile is shown again as it is now, with nothing saved. The user's password and last login are no change of the form.
This commit is contained in:
parent
35a5bbdb62
commit
ab77b198f2
12 changed files with 208 additions and 121 deletions
|
|
@ -3,6 +3,7 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from admin.tests.edits import user_seen
|
||||
|
||||
LIMITS = {"role": "user", "max_instances": 1, "max_cpus": 1, "max_memory": 1, "max_disk_size": 4}
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ class UserUpdateNextTests(TestCase):
|
|||
|
||||
def save(self, next_url):
|
||||
url = reverse("admin:user_update", args=[self.user.id]) + "?next=" + next_url
|
||||
return self.client.post(url, {"username": "un-user", "is_active": "on", **LIMITS})
|
||||
return self.client.post(url, {"username": "un-user", "is_active": "on", "seen": user_seen(self.user), **LIMITS})
|
||||
|
||||
def test_a_page_of_this_site(self):
|
||||
account = reverse("accounts:account", args=[self.user.id])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue