Coverage for src/backend/InvenTree/common/migrations/0029_inventreecustomuserstatemodel.py: 100%
6 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 17:47 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 17:47 +0000
1# Generated by Django 4.2.14 on 2024-08-07 22:40
3import django.db.models.deletion
4from django.db import migrations, models
6from common.models import state_color_mappings
9class Migration(migrations.Migration):
11 dependencies = [
12 ("contenttypes", "0002_remove_content_type_name"),
13 ("common", "0028_colortheme_user_obj"),
14 ]
16 operations = [
17 migrations.CreateModel(
18 name="InvenTreeCustomUserStateModel",
19 fields=[
20 (
21 "id",
22 models.AutoField(
23 auto_created=True,
24 primary_key=True,
25 serialize=False,
26 verbose_name="ID",
27 ),
28 ),
29 (
30 "key",
31 models.IntegerField(
32 help_text="Value that will be saved in the models database",
33 verbose_name="Key",
34 ),
35 ),
36 (
37 "name",
38 models.CharField(
39 help_text="Name of the state",
40 max_length=250,
41 verbose_name="Name",
42 ),
43 ),
44 (
45 "label",
46 models.CharField(
47 help_text="Label that will be displayed in the frontend",
48 max_length=250,
49 verbose_name="Label",
50 ),
51 ),
52 (
53 "color",
54 models.CharField(
55 choices=state_color_mappings(),
56 default="secondary",
57 help_text="Color that will be displayed in the frontend",
58 max_length=10,
59 verbose_name="Color",
60 ),
61 ),
62 (
63 "logical_key",
64 models.IntegerField(
65 help_text="State logical key that is equal to this custom state in business logic",
66 verbose_name="Logical Key",
67 ),
68 ),
69 (
70 "reference_status",
71 models.CharField(
72 help_text="Status set that is extended with this custom state",
73 max_length=250,
74 verbose_name="Reference Status Set",
75 ),
76 ),
77 (
78 "model",
79 models.ForeignKey(
80 blank=True,
81 help_text="Model this state is associated with",
82 null=True,
83 on_delete=django.db.models.deletion.SET_NULL,
84 to="contenttypes.contenttype",
85 verbose_name="Model",
86 ),
87 ),
88 ],
89 options={
90 "verbose_name": "Custom State",
91 "verbose_name_plural": "Custom States",
92 "unique_together": {
93 ("model", "reference_status", "key", "logical_key")
94 },
95 },
96 ),
97 ]