Ajout modif 'is_frozen' sur account create et update

This commit is contained in:
Aurélien Delobelle 2016-09-03 22:52:55 +02:00
parent 0d900eadbb
commit 04932dd22a
2 changed files with 5 additions and 4 deletions

View file

@ -49,7 +49,7 @@ class AccountForm(forms.ModelForm):
class Meta:
model = Account
fields = ['trigramme', 'promo', 'nickname']
fields = ['trigramme', 'promo', 'nickname', 'is_frozen']
widgets = {
'trigramme': forms.TextInput(attrs={'autocomplete': 'off'}),
}
@ -69,7 +69,7 @@ class AccountNoTriForm(AccountForm):
class AccountRestrictForm(AccountForm):
class Meta(AccountForm.Meta):
fields = ['promo']
fields = ['is_frozen']
class AccountPwdForm(forms.Form):
pwd1 = forms.CharField(

View file

@ -285,7 +285,7 @@ def account_update(request, trigramme):
negative_form = None
else:
user_form = UserRestrictForm(instance=account.user)
account_form = None
account_form = AccountRestrictForm(instance=account)
cof_form = None
group_form = None
negative_form = None
@ -358,8 +358,9 @@ def account_update(request, trigramme):
missing_perm = False
user_form = UserRestrictForm(request.POST, instance=account.user)
if user_form.is_valid():
if user_form.is_valid() and account_form.is_valid():
user_form.save()
account_form.save()
success = True
messages.success(request, 'Vos informations ont été mises à jour')