Question

How can I extend Auth to allow for multiple users with the same username. In SAAS this is a need because two accounts might have a user called "owner" or something like that.

Was it helpful?

Solution

You could probably subclass the User model and write a custom authentication backend for your new model.

But first I would ask myself "do I REALLY need this?". Having multiple users with the same username sounds like a mess.

OTHER TIPS

The problem with "user names" is that on a site with any decent size population Spencer's Lament (Henry Spencer @ U Toronto, Dept. of Zoology) comes into play: all of the good ones are taken. (He was referring to host names in the pre-DNS days, but it still applies.) The only "name" that is pretty much guaranteed to be unique is ... the email address. If you use that as Django's login identifier, then you can allow the user.username to be non-unique and used as a screen name. You still have to allow for people to change their email addresses, but they should still be unique across all users of a site.

We had to do this for a long-established site, as mentioned in this thread.

You can't. Prefix the user name with the account name instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top