diff --git a/fet2020/posts/migrations/0003_post_status.py b/fet2020/posts/migrations/0003_post_status.py new file mode 100644 index 00000000..2693b798 --- /dev/null +++ b/fet2020/posts/migrations/0003_post_status.py @@ -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'), + ), + ] diff --git a/fet2020/posts/migrations/0004_auto_20220111_2311.py b/fet2020/posts/migrations/0004_auto_20220111_2311.py new file mode 100644 index 00000000..8b202019 --- /dev/null +++ b/fet2020/posts/migrations/0004_auto_20220111_2311.py @@ -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), + ] diff --git a/fet2020/posts/migrations/0005_remove_post_is_hidden.py b/fet2020/posts/migrations/0005_remove_post_is_hidden.py new file mode 100644 index 00000000..994e5588 --- /dev/null +++ b/fet2020/posts/migrations/0005_remove_post_is_hidden.py @@ -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', + ), + ]