For a SaaS Application, I would like to have a custom subsite for each Client. Each subsite will have Users, for which I would like to use Django's default User Model.
The subsite is defined by the subdomain, so e.g. client1.example.com
and client2.example.com
will be two different subsites that run on the same application.
I would like to have unique Users in each subsite, so e.g. alice@email.com
would be able to sign up for multiple subsites with the same username (email).
How can I alter the Django User Model to also include a client_id
and then perform a unique_together
constraint on both client_id
and username
? Do I have to rewrite the whole authentication backend for this?