This repository has been archived on 2023-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
python-blog/articles/migrations/0002_article.py

51 lines
1.6 KiB
Python
Raw Normal View History

2020-08-14 15:53:42 +02:00
# Generated by Django 3.1 on 2020-08-14 13:16
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("articles", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Article",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("content", models.TextField()),
(
"status",
models.CharField(
choices=[("draft", "Draft"), ("published", "Published")],
default="draft",
max_length=15,
),
),
("published_at", models.DateTimeField(null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
to=settings.AUTH_USER_MODEL,
),
),
],
2020-09-05 09:09:59 +02:00
options={"ordering": ["-published_at"]},
2020-08-14 15:53:42 +02:00
),
]