add migrations

This commit is contained in:
2022-01-12 22:46:33 +00:00
parent 8c8a3d378a
commit 310a945bc9
3 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 4.0.1 on 2022-01-11 21:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0002_fileupload'),
]
operations = [
migrations.AddField(
model_name='post',
name='status',
field=models.CharField(choices=[('10', 'DRAFT'), ('15', 'ONLY_INTERN'), ('20', 'PUBLIC')], default='10', max_length=2, verbose_name='Status'),
),
]

View File

@@ -0,0 +1,22 @@
# Generated by Django 4.0.1 on 2022-01-11 22:11
from django.db import migrations
def forwards_func(apps, schema_editor):
Posts = apps.get_model("posts", "Post")
# set current published posts to status 'PUBLIC'
Posts.objects.filter(is_hidden=False).update(status="20")
# set current hidden posts to status 'ONLY INTERN'
Posts.objects.filter(is_hidden=True).update(status="15")
class Migration(migrations.Migration):
dependencies = [
('posts', '0003_post_status'),
]
operations = [
migrations.RunPython(forwards_func),
]

View File

@@ -0,0 +1,17 @@
# Generated by Django 4.0.1 on 2022-01-11 22:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0004_auto_20220111_2311'),
]
operations = [
migrations.RemoveField(
model_name='post',
name='is_hidden',
),
]