add migrations
This commit is contained in:
18
fet2020/posts/migrations/0003_post_status.py
Normal file
18
fet2020/posts/migrations/0003_post_status.py
Normal 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'),
|
||||||
|
),
|
||||||
|
]
|
||||||
22
fet2020/posts/migrations/0004_auto_20220111_2311.py
Normal file
22
fet2020/posts/migrations/0004_auto_20220111_2311.py
Normal 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),
|
||||||
|
]
|
||||||
17
fet2020/posts/migrations/0005_remove_post_is_hidden.py
Normal file
17
fet2020/posts/migrations/0005_remove_post_is_hidden.py
Normal 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',
|
||||||
|
),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user