Skip to content

Commit d4e4fdb

Browse files
authored
Update created_at
Add the auto_now_add attribute
1 parent a3ff549 commit d4e4fdb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

function_views/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ class User(models.Model):
1313
instagram_profile = models.URLField(null=True)
1414
avatar = models.CharField(max_length=250, null=True)
1515
website = models.URLField()
16-
created_at = models.DateTimeField()
16+
created_at = models.DateTimeField(auto_now_add=True)
1717

1818

1919
class Message(models.Model):
2020
"""Message left by a user in a guest book."""
2121
id = models.AutoField(primary_key=True)
2222
name = models.CharField(max_length=255)
2323
message = models.TextField()
24-
created_at = models.DateTimeField()
24+
created_at = models.DateTimeField(auto_now_add=True)

0 commit comments

Comments
 (0)