blob: fe367dd4dcde96d014ef5774d1cdfd443d939dc4 (
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
31
32
|
# Generated by Django 2.2.24 on 2024-03-25 17:24
from django.db import migrations
from ishtar_common.utils_migrations import migrations_load_data
COLOR_WARNING = "\033[93m"
COLOR_ENDC = "\033[0m"
def load_data(apps, _):
migrations_load_data("ishtar_common", "0243_default_biographicalnote_permissions.json")
Group = apps.get_model("auth", "group")
ProfileType = apps.get_model("ishtar_common", "profiletype")
q = ProfileType.objects.filter(txt_idx="administrator")
if q.count():
admin = q.all()[0]
for group in Group.objects.filter(name__icontains="biographique").all():
admin.groups.add(group)
else:
print(COLOR_WARNING + "** No administrator profile found **" + COLOR_ENDC)
print(COLOR_WARNING + "** Verify biographical notes permissions in profile **" + COLOR_ENDC)
class Migration(migrations.Migration):
dependencies = [
('ishtar_common', '0242_import_debug_field'),
]
operations = [
migrations.RunPython(load_data)
]
|