So I have a project that requires a CustomUser model.
Normally, users would signup for an account before they can create an order. By using the django-allauth package, this can be done quite easily.
I now have a challenge, not only can users create their own account by signing up, users flagged as “is_employee” should be able to create a new user and corresponding order without the need of signing up a user or fill in an emailaddress.
My thoughts on this:
- We could create a 2nd user model separate from the one being used for signup (not desirable since you would have two models with “first_name”, “last_name” etc.)
- We could create a “CustomAccount” instead of “CustomUser” and assign a OneToOne relation to “CustomUser” model.
So the CustomAccount would be used when users sign up and create an order, the personal date like “first_name” and “last_name” will be removed from the model and added into the “CustomUser” model. We can use a receiver to update “CustomUser” at the same time we create a “CustomAccount”.
Users flagged as “is_employee” would now be able to create a new user in “CustomUser” model without the requirement of filling in an emailadress or password.
Does this sound feasible or are there other preferable methods?
With best regards,