#27524: Using user instance (instead of get_user_model()) leads to errors when 
user
model is overridden
------------------------------+--------------------------------------
     Reporter:  Andy Martin   |                    Owner:  nobody
         Type:  Bug           |                   Status:  new
    Component:  contrib.auth  |                  Version:  1.8
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  1             |      Needs documentation:  0
  Needs tests:  1             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------

Comment (by Andy Martin):

 Here's the user model:

 {{{
 from bson import ObjectId
 from mongoengine import Document, StringField, BooleanField, DateTimeField

 class User(Document):
     id = StringField(required=True, primary_key=True, default=lambda:
 str(ObjectId()))
     username = StringField(required=True)
     password = StringField()
     is_active = BooleanField(default=True)
     is_staff = BooleanField(default=False)
     email = StringField()
     first_name = StringField()
     last_name = StringField()
     last_login = DateTimeField()
 }}}

 In our settings.py, we have the following values set:
 {{{
 AUTH_USER_MODEL = 'mongo_auth.MongoUser'
 MONGOENGINE_USER_DOCUMENT = '[...snip...].admin.models.User'  # (points to
 User model defined above)
 }}}

 If you think it should be the responsibility of the person overriding the
 user model to make sure it works fine with Django's contrib.auth
 implementation, that's fine with me, although googling for the error
 message shows other people seem to be hitting the same issue.

 Let me know if you think the use case is valid and, if so, I can look into
 making a regression test.

--
Ticket URL: <https://code.djangoproject.com/ticket/27524#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.dcbc6915a286831cfc42633d37a9fd75%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to