extended UserCreationForm to RegistrationForm, adding fields for email/firstname/lastname

This commit is contained in:
aeltheos 2021-10-07 16:50:35 +02:00
parent aeb9cafd40
commit ecc80b939d
2 changed files with 18 additions and 4 deletions

12
signup/forms.py Normal file
View file

@ -0,0 +1,12 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class RegistrationForm(UserCreationForm):
email = forms.EmailField(label = "Email",widget=forms.TextInput(), required=True)
first_name = forms.CharField(label="Prénom", widget=forms.TextInput(),required=True)
last_name = forms.CharField(label="Nom", widget=forms.TextInput(),required=True)
class Meta:
model = User
fields = ["username", "password1", "password2", "email", "first_name", "last_name"]