Commit 5ca21d38 authored by Bianca Aguilar's avatar Bianca Aguilar

Edited models.py so that the pub date could be automatically generated

parent bbe4e819
No preview for this file type
# Generated by Django 4.0.3 on 2022-03-16 05:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0002_alter_post_post_title_alter_post_pub_date'),
]
operations = [
migrations.AlterField(
model_name='post',
name='pub_date',
field=models.DateTimeField(auto_now=True, verbose_name='Date Published'),
),
]
......@@ -4,7 +4,7 @@ from django.db import models
class Post(models.Model):
post_title = models.CharField(max_length=50)
post_body = models.CharField(max_length=500)
pub_date = models.DateTimeField("Date Published")
pub_date = models.DateTimeField("Date Published", auto_now=True)
def __str__(self):
return '{}'.format(self.post_title)
\ 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