Skip to content

Commit

Permalink
refact migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatas1n committed Sep 19, 2022
1 parent 480a8d7 commit ee92c48
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# Generated by Django 3.2.12 on 2022-09-19 11:15

from django.db import migrations, models
from candidate.models import CandidatePage

hide_convergency = [90, 878, 4610, 90842, 105534, 123756, 141401, 141480, 141552,
160517, 204433, 207309, 214865, 219585, 219592,
204563, 122466, None]

def set_convergency(apps, schema_editor):
live_candidates = CandidatePage.objects.all().live()
for candidate in live_candidates:
is_show = candidate.id_autor not in hide_convergency
candidate.show_convergency = is_show
candidate.save()

def unset_convergency(apps, schema_editor):
live_candidates = CandidatePage.objects.all().live()
for candidate in live_candidates:
candidate.show_convergency = None
candidate.save()

class Migration(migrations.Migration):

Expand All @@ -15,4 +32,5 @@ class Migration(migrations.Migration):
name='show_convergency',
field=models.BooleanField(default=True),
),
migrations.RunPython(set_convergency, unset_convergency),
]
31 changes: 0 additions & 31 deletions landing/candidate/migrations/0029_set_convergency_visibility.py

This file was deleted.

0 comments on commit ee92c48

Please sign in to comment.