I am working on a project which has two different sets of users - Customer
and Merchant
. Both of these users should be able to register and login to their respective profiles. The most obvious choice to implement this that came to my mind was to make two different models Customer
and Merchant
that inherit from a BaseUser model that will store the common fields i.e. Multi-table inheritance - https://docs.djangoproject.com/en/1.8/topics/db/models/#multi-table-inheritance
Quoting Two Scoops of Django
-
At all costs, everyone should avoid multi-table inheritance (see warning above) since it adds both confusion and substantial overhead...
Adds substantial overhead since each query on a child table requires joins with all parent tables.
I would like to know if and why having an explicit OneToOneField
is better than Multi-table inheritance. Also, are there any other better ways to model the above relationship?