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):
|
17 | 17 | A signal receiver which updates the last_login date for |
18 | 18 | the user logging in. |
19 | 19 | """ |
20 | | user.last_login = timezone.now() |
| 20 | try: |
| 21 | user.last_login = timezone.now() |
| 22 | except AttributeError: |
| 23 | return |
21 | 24 | user.save(update_fields=['last_login']) |
22 | 25 | |
23 | 26 | |