Skip to content

Commit d1f9695

Browse files
author
Christian Jensen
authored
Make the datetime timezone aware (#22)
When listing emails, currently they all show as being sent as if they were in GMT. This should allow the time of recording to have the `tzinfo` populated and therefore should show up properly.
1 parent 66bfdd7 commit d1f9695

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mail_panel/backend.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.core import mail
22
from django.core.mail.backends.locmem import EmailBackend
3+
from django.utils.timezone import now
34
import datetime
45
from uuid import uuid4
56

@@ -12,7 +13,7 @@ def __init__(self, message):
1213
self.id = uuid4().get_hex()
1314
except AttributeError:
1415
self.id = uuid4().hex # python 3
15-
self.date_sent = datetime.datetime.now()
16+
self.date_sent = now()
1617
self.read = False
1718
message.message() # triggers header validation
1819

0 commit comments

Comments
 (0)