Add default draft warning to new articles
This commit is contained in:
parent
059e9b0322
commit
d68f37fd33
2 changed files with 26 additions and 1 deletions
20
articles/migrations/0031_auto_20210306_1449.py
Normal file
20
articles/migrations/0031_auto_20210306_1449.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 3.1.5 on 2021-03-06 13:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("articles", "0030_tag_slug"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="article",
|
||||
name="content",
|
||||
field=models.TextField(
|
||||
default='!!! warning "Draft"\n This article is still a draft. It may appear by error in your feed if I click on the "publish" button too early 😊'
|
||||
),
|
||||
),
|
||||
]
|
|
@ -51,8 +51,13 @@ class Article(models.Model):
|
|||
(DRAFT, "Draft"),
|
||||
(PUBLISHED, "Published"),
|
||||
]
|
||||
CONTENT_DEFAULT = (
|
||||
'!!! warning "Draft"\n'
|
||||
" This article is still a draft. It may appear by error in your feed "
|
||||
'if I click on the "publish" button too early 😊'
|
||||
)
|
||||
title = models.CharField(max_length=255)
|
||||
content = models.TextField()
|
||||
content = models.TextField(default=CONTENT_DEFAULT)
|
||||
status = models.CharField(max_length=15, choices=STATUS_CHOICES, default=DRAFT)
|
||||
published_at = models.DateTimeField(null=True, blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
|
Reference in a new issue