# -*- mode: python; coding: utf-8 -*- # Copyright (C) 2017-2019 by BDE ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later from django import forms from django.core.validators import MinLengthValidator from django.forms import ModelForm from .models import User class PassForm(forms.Form): passwd1 = forms.CharField( label=u'Nouveau mot de passe', max_length=255, validators=[MinLengthValidator(8)], widget=forms.PasswordInput, ) passwd2 = forms.CharField( label=u'Saisir à nouveau le mot de passe', max_length=255, validators=[MinLengthValidator(8)], widget=forms.PasswordInput ) class BaseInfoForm(ModelForm): class Meta: model = User fields = [ 'first_name', 'username', 'last_name', 'email', 'telephone', 'address', ] class InfoForm(BaseInfoForm): class Meta(BaseInfoForm.Meta): fields = [ 'first_name', 'username', 'last_name', 'email', 'telephone', 'address', 'maxemprunt', ]