summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-07-29 08:56:00 -0400
committerTim Graham <timograham@gmail.com>2014-08-01 17:51:49 -0400
commita2479f46f3d05b37254ad701b6b76f84624d3cb5 (patch)
tree6699af07d6dee155810e24bffdfdd7449e3ae7b9 /docs
parent1a31d9ef913f954c26a4837b1ffb568ced21ff05 (diff)
Fixed #7220 -- Allowed AbstractBaseUser.last_login to be null.
Thanks veena for the suggestion and Simon Charette and Kévin Etienne for reviews.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/auth.txt8
-rw-r--r--docs/releases/1.8.txt20
2 files changed, 26 insertions, 2 deletions
diff --git a/docs/ref/contrib/auth.txt b/docs/ref/contrib/auth.txt
index 621538420d..3c96fc835a 100644
--- a/docs/ref/contrib/auth.txt
+++ b/docs/ref/contrib/auth.txt
@@ -81,8 +81,12 @@ Fields
.. attribute:: last_login
- A datetime of the user's last login. Is set to the current date/time by
- default.
+ A datetime of the user's last login.
+
+ .. versionchanged:: 1.8
+
+ This field will be ``null`` if the user has never logged in.
+ Previously it was set to the current date/time by default.
.. attribute:: date_joined
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 1623cd1af6..858d02c4bf 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -407,6 +407,26 @@ officially supports.
This also includes dropping support for PostGIS 1.3 and 1.4 as these versions
are not supported on versions of PostgreSQL later than 8.4.
+``AbstractUser.last_login`` allows null values
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The :attr:`AbstractUser.last_login <django.contrib.auth.models.User.last_login>`
+field now allows null values. Previously, it defaulted to the time when the user
+was created which was misleading if the user never logged in. Please run the
+database migration. If your custom user inherits from ``AbstractUser`` and you
+wish to set ``last_login`` to ``NULL`` for users who haven't logged in, you can
+run this query::
+
+ from django.db import models
+ from django.contrib.auth import get_user_model
+ from django.contrib.auth.models import AbstractBaseUser
+
+ UserModel = get_user_model()
+ if issubclass(UserModel, AbstractBaseUser):
+ UserModel._default_manager.filter(
+ last_login=models.F('date_joined')
+ ).update(last_login=None)
+
Miscellaneous
~~~~~~~~~~~~~