forked from mirrors/bookwyrm
37 lines
998 B
Python
37 lines
998 B
Python
# Generated by Django 3.2.4 on 2021-09-22 16:53
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def set_active_readthrough(apps, schema_editor):
|
|
"""best-guess for deactivation date"""
|
|
db_alias = schema_editor.connection.alias
|
|
apps.get_model("bookwyrm", "ReadThrough").objects.using(db_alias).filter(
|
|
start_date__isnull=False,
|
|
finish_date__isnull=True,
|
|
).update(is_active=True)
|
|
|
|
|
|
def reverse_func(apps, schema_editor):
|
|
"""noop"""
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("bookwyrm", "0098_auto_20210918_2238"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="readthrough",
|
|
name="is_active",
|
|
field=models.BooleanField(default=False),
|
|
),
|
|
migrations.RunPython(set_active_readthrough, reverse_func),
|
|
migrations.AlterField(
|
|
model_name="readthrough",
|
|
name="is_active",
|
|
field=models.BooleanField(default=True),
|
|
),
|
|
]
|