To change the email field label, you can subclass UserCreationForm as follows
from django import forms from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.forms import UserCreationForm class MyUserCreationForm(UserCreationForm): username = forms.RegexField(label=_("Email"), max_length=30, regex=r'^[\ w.@ +-]+$', help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), error_messages = {'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")})
Adding the first_name and last_name fields is not so simple because the form save method accepts only a username, email address and password. Two possibilities are possible:
- override form save method
- displays the UserChangeForm after creating the User (this is what the Django admin application does)
source share