Ticket #28247: 0001-Don-t-require-last_login-property-on-custom-user-mod.patch

File 0001-Don-t-require-last_login-property-on-custom-user-mod.patch, 859 bytes (added by Linus Lewandowski, 7 years ago)
  • django/contrib/auth/models.py

    From 768bc247eb2fadecd26ada65d01073383c18bf35 Mon Sep 17 00:00:00 2001
    From: Linus Lewandowski <linus@lew21.net>
    Date: Sat, 27 May 2017 12:35:49 +0200
    Subject: [PATCH] Don't require last_login property on custom user models
    
    ---
     django/contrib/auth/models.py | 5 ++++-
     1 file changed, 4 insertions(+), 1 deletion(-)
    
    diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
    index dad7d288c5..497fb0b095 100644
    a b def update_last_login(sender, user, **kwargs):  
    1717    A signal receiver which updates the last_login date for
    1818    the user logging in.
    1919    """
    20     user.last_login = timezone.now()
     20    try:
     21        user.last_login = timezone.now()
     22    except AttributeError:
     23        return
    2124    user.save(update_fields=['last_login'])
    2225
    2326
Back to Top