diff --git a/mongoengine/django/auth.py b/mongoengine/django/auth.py index 65afacfd..1685f6f0 100644 --- a/mongoengine/django/auth.py +++ b/mongoengine/django/auth.py @@ -70,7 +70,7 @@ class User(Document): meta = { 'allow_inheritance': True, 'indexes': [ - {'fields': ['username'], 'unique': True} + {'fields': ['username'], 'unique': True, 'sparse': True} ] }