blob: 2e77e5c7f02f5c45a16df477544839de3162b206 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# Generated by Django 2.2.24 on 2023-11-28 13:21
from django.db import migrations
def set_default_profile_value(apps, __):
model = apps.get_model("ishtar_common", "ishtarsiteprofile")
attrs = ["operation_complete_identifier", "operation_cached_label",
"contextrecord_cached_label", "parcel_cached_label",
"find_cached_label"]
for profile in model.objects.all():
changed = False
for attr in attrs:
if not getattr(profile, attr):
field = model._meta.get_field(attr)
setattr(profile, attr, field.get_default())
changed = True
if changed:
profile.save()
class Migration(migrations.Migration):
dependencies = [
('ishtar_common', '0230_auto_20231114_1334'),
]
operations = [
migrations.RunPython(set_default_profile_value)
]
|