Commits

Michael Elsdörfer committed af6cc10

Store dates in UTC.

Comments (0)

Files changed (1)

registration/models.py

         profile, created = self.get_or_create(user=user, defaults=defaults)
         if not created:
             profile.activation_key = activation_key
-            profile.date_created = datetime.datetime.now()
+            profile.date_created = datetime.datetime.utcnow()
             for key, value in kwargs.items():
                 setattr(profile, key, value)
             profile.save()
     user = models.OneToOneField(User, primary_key=True, verbose_name=_('user'))
     activation_key = models.CharField(_('activation key'), max_length=40)
     new_password = models.CharField(_('password'), max_length=128)
-    date_created = models.DateTimeField(default=datetime.datetime.now)
+    date_created = models.DateTimeField(default=datetime.datetime.utcnow)
 
     objects = RegistrationManager()
 
 
         """
         expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
-        return self.date_created + expiration_date <= datetime.datetime.now()
+        return self.date_created + expiration_date <= datetime.datetime.utcnow()
     activation_key_expired.boolean = True
 
     def send_activation_email(self, site, email_subject_template='registration/activation_email_subject.txt',
     User.add_to_class('email_confirmed',
         models.BooleanField(_('email confirmed'), default=False))
 else:
-    pass
+    pass