Update usage of datetime.now to Django timezone aware now()

This commit is contained in:
Roberto Rosario
2014-06-29 17:00:07 -04:00
parent a46642015b
commit d640eacec8
16 changed files with 54 additions and 47 deletions
+2 -1
View File
@@ -6,6 +6,7 @@ import logging
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from documents.models import Document
@@ -41,7 +42,7 @@ class DocumentCheckout(models.Model):
def save(self, *args, **kwargs):
if not self.pk:
self.checkout_datetime = datetime.datetime.now()
self.checkout_datetime = now()
result = super(DocumentCheckout, self).save(*args, **kwargs)
create_history(HISTORY_DOCUMENT_CHECKED_OUT, source_object=self.document, data={'user': self.user_object, 'document': self.document})
return result