0

Hello I am new to programming and learning.

I am having some problem in decision making for the user model in Django.

Below is the description of my project which i want to do. Please suggest me the best way to go about it.

I will have an ecommerce application where customer, shop owner, shop staff and shop delivery man will interact each other and will have the following profiles

  1. Individual User profile (register with email as username)
  2. Grocery Shop profile ( there will be many grocery shops who will register as shop on the application and will have a bit of admin site for the shop)
  3. Shop staffs profile ( working under the shop admin)
  4. Delivery man profile ( working under the shop admin)
  5. Super admin for the project
  6. Admin profile for the entire application with some privileges.

The way i want to operate is that each user will register using email as user name and by default will have a user profile.

Later suppose a user have a shop and want to register on our app (in another word if anybody want to register his shop, he need to register as a user and then apply/register for shop). At this point, if the user register his shop then he will have another Shop profile in his user admin panel.

Same way a user want to work as staff on that shop, so he can join to the shop which will be shown on the shop admin. The shop staff will have a extra staff profile in his user admin panel.

Same way, the delivery man will join and having is delivery man profile as well.

Please suggest me how to go about it for the user model, authentication and permission in Django.

  • https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html – Mohit Harshan Feb 27 '19 at 04:17
  • You have not mentioned what you have tried and asking a very broad question. If you have a custom user you can add permission like `is_shopstaff = models.BooleanField(default=False)` and so on in the User model. And send email link to verify (very much like password reset) to confirm who they are staff or delivery guy etc. – Bidhan Majhi Feb 27 '19 at 06:51
  • You have not mentioned what you have tried and asking a very broad question. If you have a custom user you can add permission like `is_shopstaff = models.BooleanField(default=False)` and so on in the User model. And send email link to verify (very much like password reset) to confirm who they are staff or delivery guy etc. – Bidhan Majhi Feb 27 '19 at 06:51
  • Hi Bidhan; Thanks a lot. you are right , i have not tired any thing yet, but i was reading many topics and wanted to make sure the starting is correct for me. I was sure to use CustomBaseUser model but whether i should go with boolean function or some thing else as one user will have multiple profile. Thanks again for your comment. – M Obayed Ullah Feb 27 '19 at 08:32
  • You can create separate model for each profiles and link oneToOneField to User Model. – bkawan Feb 27 '19 at 09:14

0 Answers0