Opened 6 years ago

Last modified 5 weeks ago

#7220 assigned Cleanup/optimization

django.contrib.auth.models.AbstractBaseUser.last_login should allow null=True

Reported by: veena Owned by: anonymous
Component: contrib.auth Version: master
Severity: Normal Keywords: schemamigration
Cc: simon@…, martin.paquette@… Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I think attribute last_login in model User in django.contrib.auth should has property null=True.
Now it has only

So, when you create new user the last_login is set to now datetime.

But when you create new user it doesn't mean that user has been logged in. For example in django-registration there is first user created and link to activation is sended to his email. After user activates his account he can login.

Attachments (0)

Change History (10)

comment:1 Changed 6 years ago by Simon Greenhill

  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 3 years ago by sven.hoffmann@…

We would like to use the field last_login to determine if a user has ever logged in.
now we need to check if last_login == date_joined to do that but that's pretty weird,
as the user actually has not logged in yet, but has a date for last_login set.
why no just have the field null until first login as suggested in this ticket?

comment:3 Changed 3 years ago by gabrielhurley

  • Component changed from Contrib apps to contrib.auth

comment:4 Changed 3 years ago by lukeplant

  • Severity set to Normal
  • Type set to Bug

comment:5 Changed 3 years ago by SmileyChris

  • Easy pickings unset
  • Triage Stage changed from Design decision needed to Someday/Maybe

The problem is that it leaves any User model created previously in an indeterminate state, since we have no way to provide migrations in core.

For that reason, I'm shunting this to a 'someday' issue.

comment:6 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:7 Changed 10 months ago by mohitbagga

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:8 Changed 9 months ago by timo

  • Keywords schemamigration added; auth last login user removed
  • Summary changed from Last_login in django.contrib.auth should has null=True to django.contrib.auth.models.AbstractBaseUser.last_login should allow null=True
  • Type changed from Bug to Cleanup/optimization

comment:9 Changed 5 months ago by simon29

  • Cc simon@… added

comment:10 Changed 5 weeks ago by martinpaquette

  • Cc martin.paquette@… added

Add Comment

Modify Ticket

Change Properties
<Author field>
as assigned
Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.