Commit f49edb0e authored by Élie Bouttier's avatar Élie Bouttier

inscriptions automatiques aux tâches après migration

parent 3764c7fd
# Generated by Django 2.2 on 2019-05-12 08:43
from django.db import migrations
def set_subscribers(apps, schema_editor):
db_alias = schema_editor.connection.alias
Task = apps.get_model("todo", "Task")
for task in Task.objects.using(db_alias).all():
task.subscribers.add(task.created_by)
if task.assigned_to:
task.subscribers.add(task.assigned_to)
for comment in task.comments.all():
task.subscribers.add(comment.author)
class Migration(migrations.Migration):
dependencies = [
('todo', '0002_auto_20190511_1531'),
]
operations = [
migrations.RunPython(set_subscribers),
]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment