Boulangerie_Website/backend/notes/migrations/0005_normalize_polls_public.py
Louis Mazin 4db822aebe big maj
2026-10-05 17:52:28 +02:00

21 lines
578 B
Python

from django.db import migrations
def normalize_polls(apps, schema_editor):
Note = apps.get_model('notes', 'Note')
Poll = apps.get_model('notes', 'Poll')
polls = Note.objects.filter(kind='poll')
polls.update(is_public=True)
for note in polls.iterator():
note.recipients.clear()
Poll.objects.update(closes_at=None)
class Migration(migrations.Migration):
dependencies = [('notes', '0004_alter_note_kind_poll_polloption_pollvote_and_more')]
operations = [
migrations.RunPython(normalize_polls, migrations.RunPython.noop),
]