32 lines
884 B
Python
32 lines
884 B
Python
|
# Generated by Django 3.2.3 on 2021-05-19 21:46
|
||
|
|
||
|
from django.db import migrations
|
||
|
import recurrence
|
||
|
import recurrence.fields
|
||
|
|
||
|
def transfer_recurrence(apps, schema_editor):
|
||
|
Task = apps.get_model('tasks', 'task')
|
||
|
for task in Task.objects.all():
|
||
|
task.recurrence = recurrence.deserialize('RRULE:' + task.recurrence_interval)
|
||
|
task.save(update_fields=['recurrence'])
|
||
|
|
||
|
|
||
|
class Migration(migrations.Migration):
|
||
|
dependencies = [
|
||
|
('tasks', '0002_tool_slug'),
|
||
|
]
|
||
|
|
||
|
operations = [
|
||
|
migrations.AddField(
|
||
|
model_name='task',
|
||
|
name='recurrence',
|
||
|
field=recurrence.fields.RecurrenceField(default=''),
|
||
|
preserve_default=False,
|
||
|
),
|
||
|
migrations.RunPython(transfer_recurrence),
|
||
|
migrations.RemoveField(
|
||
|
model_name='task',
|
||
|
name='recurrence_interval',
|
||
|
),
|
||
|
]
|