Editing the User model registration form, multiple user types on one form

15 views
Skip to first unread message

Taha Arif

unread,
Jun 18, 2019, 6:42:13 PM6/18/19
to Django users
I have a user model registration form, I want to modify it to include a radio button that when triggered opens up a few more fields. 

from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm


class UserCreateForm(UserCreationForm):
    class Meta:
        fields = ("username", "email", "password1", "password2")
        model = get_user_model()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields["username"].label = "Display name"
        self.fields["email"].label = "Email address"



It is very basic, but i want to offer the option on the form to have a Public Artist Profile (PAP) or a Private Consumer Profile (PCP) ON THE SAME FORM. If they select PAP, then I want to get some more information from them and approve their application to enable them to create postings in the store. 

I need help with the following. 

1. How should I set up User types. I want PAPs to have access to the same methods as PCP's, with their own additional custom methods to post items to the store. Should they be in separate Databases? Should PCP inherit from the User model, and PAP inherit from the PCP model?

2. How can I create one user registration from to handle this issue?











Reply all
Reply to author
Forward
0 new messages