The default UserCreationForm in django.contrib.auth.forms only asks
for username and password.  Given that users also have first and last
names and emails, it would be natural for the default form to provide
fields for these also.  One way to provide these extra fields is to
define a subclass of UserCreationForm in forms.py as follows:

from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User

class LongUserCreationForm(UserCreationForm):

    class Meta:
        model = User
        fields = ['username', 'first_name', 'last_name', 'email']

And then replace occurrences of UserCreationForm() in views by
LongUserCreationForm().

But, and this is my question, is this the right way to do this or is
there a better way?

Rodney
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to