Coverage for app/venv/lib/python3.14/site-packages/weblate/accounts/migrations/0021_audit_address.py: 100%
7 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
1# Copyright © Michal Čihař <michal@weblate.org>
2#
3# SPDX-License-Identifier: GPL-3.0-or-later
5# Generated by Django 5.2.6 on 2025-11-01 09:36
7from django.db import migrations
10def update_audit_log(apps, schema_editor) -> None:
11 """Remove detailed audit log info for admin actions."""
12 AuditLog = apps.get_model("accounts", "AuditLog")
13 AuditLog.objects.filter(
14 activity__in={
15 "invited",
16 "admin-locked",
17 "autocreated",
18 "blocked",
19 "enabled",
20 "disabled",
21 "disabled-expiry",
22 }
23 ).update(address=None, user_agent="")
26class Migration(migrations.Migration):
27 dependencies = [
28 ("accounts", "0020_alter_auditlog_activity"),
29 ]
31 operations = [
32 migrations.RunPython(
33 update_audit_log, migrations.RunPython.noop, elidable=True
34 ),
35 ]