How to make several types of users during registration?

I am using Django 1.2, and I want to have two types of users (one for companies and one for consultants). I either use an object in my model (something like a boolean for is_company or is_consultant) or a Django group to distinguish them - depending on which is easier for this problem. I think this would not be a big problem if I were not a complete noob;)

I use django-registration for my authentication backend, and I will have a separate form on my web page for each type of user (consultant company). I don’t think that it’s best to create two different views that are almost identical for the two cases, so I wonder how best to identify / register users who subscribe as one of two types.

Thank you for your help.

+5
source share
2 answers

, , ? , , RegistrationForm, django ( , .)

, - :

from registration.forms import RegistrationForm

USER_TYPES = (
   ('consultant', 'Consultant'),
   ('company', 'Company'),
)

class MyRegistrationForm(RegistrationForm):
     user_type = forms.ChoiceField(choices=USER_TYPES)

, , django-registration

, .

+2

, POST, . , "button" ( ) /form?type=consultant, /form?type=company, GET

+1

All Articles