Skip to content

Commit 2871c2c

Browse files
committed
Fix linter error on strftime
microsoft/vscode-docs#2252
1 parent a63c5de commit 2871c2c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

hello/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from django.db import models
2+
from django.utils import timezone
23

34
class LogMessage(models.Model):
45
message = models.CharField(max_length=300)
56
log_date = models.DateTimeField("date logged")
67

78
def __str__(self):
89
"""Returns a string representation of a message."""
9-
return f"'{self.message}' logged on {self.log_date.strftime('%A, %d %B, %Y at %X')}"
10+
date = timezone.localtime(self.log_date)
11+
return f"'{self.message}' logged on {date.strftime('%A, %d %B, %Y at %X')}"

0 commit comments

Comments
 (0)