Coverage for app/venv/lib/python3.14/site-packages/weblate/configuration/migrations/0001_squashed_weblate_5.py: 100%
11 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 4.2.5 on 2023-09-18 08:07
7from django.db import migrations, models
9CATEGORY_MT = 2
12def migrate_machinery(apps, schema_editor) -> None:
13 Setting = apps.get_model("configuration", "Setting")
15 for name in ("weblate", "weblate-translation-memory"):
16 Setting.objects.create(category=CATEGORY_MT, name=name, value={})
19class Migration(migrations.Migration):
20 replaces = [
21 ("configuration", "0001_initial"),
22 ("configuration", "0002_alter_setting_options"),
23 ("configuration", "0003_alter_setting_category"),
24 ("configuration", "0004_machinery"),
25 ]
27 initial = True
29 dependencies = [
30 ("trans", "0001_squashed_weblate_5"),
31 ]
33 operations = [
34 migrations.CreateModel(
35 name="Setting",
36 fields=[
37 (
38 "id",
39 models.AutoField(
40 auto_created=True,
41 primary_key=True,
42 serialize=False,
43 verbose_name="ID",
44 ),
45 ),
46 (
47 "category",
48 models.IntegerField(choices=[(1, "UI"), (2, "MT")], db_index=True),
49 ),
50 ("name", models.CharField(max_length=100)),
51 ("value", models.JSONField()),
52 ],
53 options={
54 "unique_together": {("category", "name")},
55 "verbose_name": "Setting",
56 "verbose_name_plural": "Settings",
57 },
58 ),
59 migrations.RunPython(migrate_machinery, migrations.RunPython.noop),
60 ]