#26823: auth signal receiver update_last_login not compatible with custom user
models that have no last_login field
-------------------------------+--------------------
     Reporter:  hjwp           |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.9
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 In my experiments with building a minimal custom user model, I've managed
 to build one that has just one field, email.  Which I think is brilliant
 of course.   One feature in the `auth` module is stopping it from working
 though, the `update_last_login` signal receiver from contrib.auth.models,
 which is wired up in `auth.signals.user_logged_in`.

 My workaround is to do a

 {{{
 from django.contrib import auth
 auth.signals.user_logged_in.disconnect(auth.models.update_last_login)
 }}}

 But we could make the signal handler more resilient.  Something like this?

 {{{
 def update_last_login(sender, user, **kwargs):
     if not hasattr(user, 'last_login'):
         return
 }}}

 PR to follow...

--
Ticket URL: <https://code.djangoproject.com/ticket/26823>
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/047.4780f895bb6c50fc2b41fe50c8e0fed9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to