Let’s say you have a registrations
app.
In this app you then have a Company
model, this may be only the id
and name
of this company. Your User
model will have a company = models.ForeignKey(Company)
to a Company.
So when your User
gets registered:
if a non-registered user is allowed to see all companies: you can display a select for him to choose it’s company, then he will be binded to this specific company when you registrate him.
If a non-registered user is not allowed to see all companies: you have some options:
- Allow the user to registrate without a company, and later bind to a specific company on the admin, this is will require that you do some checks on others views if the user is already binded to a company.
- Have some
Supervisor
that will be binded to a company, and your non-registered user can input his email when registering. - Create some unique code (not the database id) to represent a company, and receive this code when the user registrates.
All of this solutions works, it’s up to you decide which one is the best for your needs.