How to customize basic user registration form?


#1

Hi,

I would like to customize or extend the default user registration form in Django to include ‘company name’ and ‘country’ in the form and map it against the Users in Admin. My research on stackoverflow etc show that there are certain ways to create a model and then create modelForm in forms.py to include field. But somehow these additional fields does not get attached to default User fields.

Is there any help as I’m really struggling to create customized sign up form for my project?

Thanks,

Abdul Hannan


#2

Are you using the Hello Web App tutorial or something custom?


#3

Hi Tracy,

I am trying to use custom form because in 90% of the actual projects we need to capture more information about the user than default django registration form provides.


#4

Sorry, I should have been more clear. Do you have Hello Web App itself? It doesn’t set up a custom user but instead walks you through creating a Profile (which you can add “company name” and “country” to) and then create a two page registration form that’ll include those fields.

If you have Hello Web App, I can help you figure out how to apply your question to the tutorial. Let me know though if you don’t have the Hello Web App tutorial.


#5

Hi Tracy,

I have been using hello web app tutorials which are available here:

https://hellowebapp.com/tutorial/intro/

Is this what you referring to?

I have somehow worked out a solution to create a UserProfile in models and redirect the User to this page when they verify their email. This my crude way of capturing complete user data without disturbing Django’s default User registration process which seems quite powerful.


#6

Okay perfect — did you get to the Registration chapter in the tutorial? It creates a two-step reg process which should work for what you need. Just need to change your “Thing” model example to one that includes the fields you need.