2021-05-19 18:22:33 -04:00
|
|
|
# Generated by Django 3.2.3 on 2021-05-19 21:46
|
|
|
|
|
|
|
|
from django.db import migrations
|
2024-01-17 21:17:24 -05:00
|
|
|
|
2021-05-19 18:22:33 -04:00
|
|
|
import recurrence
|
|
|
|
import recurrence.fields
|
|
|
|
|
2022-02-14 12:44:42 -05:00
|
|
|
|
2021-05-19 18:22:33 -04:00
|
|
|
def transfer_recurrence(apps, schema_editor):
|
2022-02-14 12:44:42 -05:00
|
|
|
Task = apps.get_model("tasks", "task")
|
2021-05-19 18:22:33 -04:00
|
|
|
for task in Task.objects.all():
|
2022-02-14 12:44:42 -05:00
|
|
|
task.recurrence = recurrence.deserialize("RRULE:" + task.recurrence_interval)
|
|
|
|
task.save(update_fields=["recurrence"])
|
2021-05-19 18:22:33 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
2022-02-14 12:44:42 -05:00
|
|
|
("tasks", "0002_tool_slug"),
|
2021-05-19 18:22:33 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.AddField(
|
2022-02-14 12:44:42 -05:00
|
|
|
model_name="task",
|
|
|
|
name="recurrence",
|
|
|
|
field=recurrence.fields.RecurrenceField(default=""),
|
2021-05-19 18:22:33 -04:00
|
|
|
preserve_default=False,
|
|
|
|
),
|
|
|
|
migrations.RunPython(transfer_recurrence),
|
|
|
|
migrations.RemoveField(
|
2022-02-14 12:44:42 -05:00
|
|
|
model_name="task",
|
|
|
|
name="recurrence_interval",
|
2021-05-19 18:22:33 -04:00
|
|
|
),
|
|
|
|
]
|