diff --git a/news/migrations/0003_auto_20200507_1737.py b/news/migrations/0003_auto_20200507_1737.py new file mode 100644 index 000000000..12f807de0 --- /dev/null +++ b/news/migrations/0003_auto_20200507_1737.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.12 on 2020-05-07 17:37 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0002_auto_20190713_1335'), + ] + + operations = [ + migrations.AlterField( + model_name='post', + name='publish', + field=models.DateTimeField(default=django.utils.timezone.now, null=True), + ), + ] diff --git a/news/migrations/0004_auto_20200507_1741.py b/news/migrations/0004_auto_20200507_1741.py new file mode 100644 index 000000000..995ab695f --- /dev/null +++ b/news/migrations/0004_auto_20200507_1741.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.12 on 2020-05-07 17:41 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0003_auto_20200507_1737'), + ] + + operations = [ + migrations.AlterField( + model_name='post', + name='publish', + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True), + ), + ] diff --git a/news/models.py b/news/models.py index 7c5a27fd7..91b075f1f 100644 --- a/news/models.py +++ b/news/models.py @@ -19,7 +19,7 @@ class Post(models.Model): slug = models.SlugField(max_length=250, unique_for_date='publish') author = models.ForeignKey(User, related_name='blog_posts', on_delete=models.SET_NULL, null=True, blank=True) body = models.TextField() - publish = models.DateTimeField(default=timezone.now, blank=True) + publish = models.DateTimeField(default=timezone.now, null=True, blank=True) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) status = models.CharField(max_length=12, choices=STATUS_CHOICES, default='draft')