Files
django-mfa2/mfa/migrations/0009_user_keys_owned_by_enterprise.py
Mohamed ElKalioby b5f5f1691a Adding Black
2024-01-23 14:08:45 +03:00

28 lines
756 B
Python

# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
def update_owned_by_enterprise(apps, schema_editor):
user_keys = apps.get_model("mfa", "user_keys")
user_keys.objects.filter(key_type="FIDO2").update(
owned_by_enterprise=getattr(settings, "MFA_OWNED_BY_ENTERPRISE", False)
)
class Migration(migrations.Migration):
dependencies = [
("mfa", "0008_user_keys_last_used"),
]
operations = [
migrations.AddField(
model_name="user_keys",
name="owned_by_enterprise",
field=models.NullBooleanField(default=None),
),
migrations.RunPython(update_owned_by_enterprise),
]