Django Login Error

24 views
Skip to first unread message

lalitaquasoft

unread,
Jul 29, 2018, 7:44:23 AM7/29/18
to Django users

IntegrityError at /register/

UNIQUE constraint failed: superuser_user.username 


How to remove Unique username 

Kasper Laudrup

unread,
Jul 29, 2018, 8:08:06 AM7/29/18
to django...@googlegroups.com
Hi,

On 2018-07-29 10:27, lalitaquasoft wrote:
>
> How to remove Unique username
>

How would you expect user management to work if usernames are not unique?

Are you planning to differentiate users with identical usernames some
other way?

Kind regards,

Kasper Laudrup

Deepak sharma

unread,
Jul 29, 2018, 1:55:34 PM7/29/18
to Django users
I recommend : DON'T, because it is by default UserIdentifier, It is used to make UserLogins and you have to override a lot of builtIns to achieve what you are trying to do.
 

But if you still want to:

`username` validator is defined in AbstractUser Class, and inheritence flow is like: 

AbstractUser -> User

i believe only way to overide this validation is to create a Proxy Model


Melvyn Sopacua

unread,
Jul 29, 2018, 3:15:43 PM7/29/18
to django...@googlegroups.com
On zondag 29 juli 2018 14:07:19 CEST Kasper Laudrup wrote:

> On 2018-07-29 10:27, lalitaquasoft wrote:
> > How to remove Unique username
>
> How would you expect user management to work if usernames are not unique?

By using split fields. I've ran into this as well, as I want to allow the same
username per different domain - ya know, like emails.

I ended up with a choice to duplicate the data as a single database field or
ditch django.contrib.auth. I went for solving the problem at the form level
and not storing the username / domain in the custom user model, but storing it
as an email field that had to be unique.
--
Melvyn Sopacua


Reply all
Reply to author
Forward
0 new messages