Ticket #14981: models.py.diff

File models.py.diff, 1.9 KB (added by jamercee, 14 years ago)

Patched django.contrib.auth.models.py code to store dates in UTC format

  • models.py

     
    4646    A signal receiver which updates the last_login date for
    4747    the user logging in.
    4848    """
    49     user.last_login = datetime.datetime.now()
     49    user.last_login = datetime.datetime.utcnow()
    5050    user.save()
    5151user_logged_in.connect(update_last_login)
    5252
     
    116116        """
    117117        Creates and saves a User with the given username, e-mail and password.
    118118        """
    119         now = datetime.datetime.now()
     119        now = datetime.datetime.utcnow()
    120120
    121121        # Normalize the address by lowercasing the domain part of the email
    122122        # address.
     
    211211    is_staff = models.BooleanField(_('staff status'), default=False, help_text=_("Designates whether the user can log into this admin site."))
    212212    is_active = models.BooleanField(_('active'), default=True, help_text=_("Designates whether this user should be treated as active. Unselect this instead of deleting accounts."))
    213213    is_superuser = models.BooleanField(_('superuser status'), default=False, help_text=_("Designates that this user has all permissions without explicitly assigning them."))
    214     last_login = models.DateTimeField(_('last login'), default=datetime.datetime.now)
    215     date_joined = models.DateTimeField(_('date joined'), default=datetime.datetime.now)
     214    last_login = models.DateTimeField(_('last login'), default=datetime.datetime.utcnow)
     215    date_joined = models.DateTimeField(_('date joined'), default=datetime.datetime.utcnow)
    216216    groups = models.ManyToManyField(Group, verbose_name=_('groups'), blank=True,
    217217        help_text=_("In addition to the permissions manually assigned, this user will also get all permissions granted to each group he/she is in."))
    218218    user_permissions = models.ManyToManyField(Permission, verbose_name=_('user permissions'), blank=True)
Back to Top