kadenios/elections/migrations/0033_inactive_users.py

21 lines
533 B
Python

# Generated by Django 3.2.6 on 2021-10-04 07:49
from django.db import migrations
def set_users_inactive(apps, schema_editor):
db_alias = schema_editor.connection.alias
User = apps.get_model("elections", "User")
User.objects.using(db_alias).filter(election__isnull=False).update(is_active=False)
class Migration(migrations.Migration):
dependencies = [
("elections", "0032_auto_20210820_0023"),
]
operations = [
migrations.RunPython(set_users_inactive, migrations.RunPython.noop),
]