Merge branch 'Aufinal/fix_missing_names' into 'master'

Fix le problème des prénoms manquants

See merge request klub-dev-ens/gestioCOF!378
This commit is contained in:
Martin Pepin 2019-11-04 15:39:35 +01:00
commit f9cde30e08
2 changed files with 2 additions and 5 deletions

View file

@ -376,7 +376,7 @@ class AccountUpdateViewTests(ViewTestCaseMixin, TestCase):
self.users["user1"].refresh_from_db() self.users["user1"].refresh_from_db()
self.assertInstanceExpected( self.assertInstanceExpected(
self.accounts["user1"], {"first_name": "The first", "last_name": "The last"} self.accounts["user1"], {"first_name": "first", "last_name": "last"}
) )
def test_post_forbidden(self): def test_post_forbidden(self):

View file

@ -55,7 +55,6 @@ from kfet.forms import (
UserForm, UserForm,
UserGroupForm, UserGroupForm,
UserInfoForm, UserInfoForm,
UserRestrictForm,
) )
from kfet.models import ( from kfet.models import (
Account, Account,
@ -415,12 +414,10 @@ def account_update(request, trigramme):
if request.user == account.user: if request.user == account.user:
missing_perm = False missing_perm = False
account.refresh_from_db() account.refresh_from_db()
user_form = UserRestrictForm(request.POST, instance=account.user)
account_form = AccountRestrictForm(request.POST, instance=account) account_form = AccountRestrictForm(request.POST, instance=account)
pwd_form = AccountPwdForm(request.POST) pwd_form = AccountPwdForm(request.POST)
if user_form.is_valid() and account_form.is_valid(): if account_form.is_valid():
user_form.save()
account_form.save() account_form.save()
success = True success = True
messages.success(request, "Vos informations ont été mises à jour") messages.success(request, "Vos informations ont été mises à jour")