Skip to content

Commit 2ad7c56

Browse files
committed
Use str instead of unicode for python 3, add self to vars, use an f string
1 parent 1b0fcd8 commit 2ad7c56

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hello/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ class LogMessage(models.Model):
55
message = models.CharField(max_length=300)
66
log_date = models.DateTimeField("date logged")
77

8-
def __unicode__(self):
8+
def __str__(self):
99
"""Returns a string representation of a message."""
10-
return "'" + self.text + "' logged on " + log_date.strftime('%A, %d %B, %Y at %X')
10+
return f"'{self.message}' logged on {self.log_date.strftime('%A, %d %B, %Y at %X')}"

0 commit comments

Comments
 (0)