0

I know that Django has class-based generic views which give us ability to (for instance signup) signup users, but it has a little option and I want to add more fields to it, How can I do it? Thanks;

In the views.py

from django.views.generic import CreateView
from django.contrib.auth.forms import UserCreationForm
from django.core.urlresolvers import reverse_lazy

class SignUpView(CreateView):
    form_class = UserCreationForm
    template_name = "profiles/signup.html"
    success_url = reverse_lazy('profiles_home')

In the urls.py

urlpatterns = patterns('profiles.views',
    url(r'^signup', SignUpView.as_view(), name="profiles_signup"),
    )

I want to add E-mail, First and Last name, ... fields.

Alireza Ghaffari
  • 51
  • 1
  • 2
  • 11
  • What have you done so far to do that? You gotta share your code in here if you want to get help. – Ozgur Vatansever Feb 16 '15 at 07:23
  • You need to create a custom registration page! instead of using `UserCreationForm` – Mazdak Feb 16 '15 at 07:34
  • Subclass `UserCreationForm` and your extra fields to it. – Ozgur Vatansever Feb 16 '15 at 07:39
  • I know I can create my own tables for doing it, but I want to know if I can do it on `UserCreationForm` – Alireza Ghaffari Feb 16 '15 at 07:49
  • 1
    @AlirezaGhaffari You can do it too , but the first one is much better! checkout http://jessenoller.com/blog/2011/12/19/quick-example-of-extending-usercreationform-in-django and following question http://stackoverflow.com/questions/5745197/django-create-custom-usercreationform-basic – Mazdak Feb 16 '15 at 07:52

0 Answers0