Updated models.py set default in pub_datetime

parent 01df419a
from django.db import models from django.db import models
from django.utils import timezone
from dashboard.models import WidgetUser from dashboard.models import WidgetUser
...@@ -17,4 +17,7 @@ class Reply(models.Model): ...@@ -17,4 +17,7 @@ class Reply(models.Model):
post = models.ForeignKey(ForumPost, on_delete=models.CASCADE, null=True) post = models.ForeignKey(ForumPost, on_delete=models.CASCADE, null=True)
body = models.TextField() body = models.TextField()
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE) author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField() pub_datetime = models.DateTimeField(default=timezone.now, null=True, blank=True)
def __str__(self):
return self.post
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment