Commits

Peter Wright  committed 51a1c18

Updated activation_key_expired to use timezone-aware datetimes.

  • Participants
  • Parent commits 4597da2

Comments (0)

Files changed (1)

File registration/models.py

 from django.template.loader import render_to_string
 from django.utils.hashcompat import sha_constructor
 from django.utils.translation import ugettext_lazy as _
+from django.utils.timezone import utc
 
 
 SHA1_RE = re.compile('^[a-f0-9]{40}$')
 
         """
         expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
-        return self.activation_key == self.ACTIVATED or \
-               (self.user.date_joined + expiration_date <= datetime.datetime.now())
+        return self.activation_key == self.ACTIVATED or (
+                self.user.date_joined + expiration_date <= \
+                    datetime.datetime.utcnow().replace(tzinfo=utc))
     activation_key_expired.boolean = True
 
     def send_activation_email(self, site,