131cb27d16
Django project: employees, locations, visit_manager, it_manager, mattermost_connector and stub connectors (ad, mail, portal).
66 lines
4.8 KiB
Python
66 lines
4.8 KiB
Python
# Generated by Django 6.0.3 on 2026-04-06 10:32
|
|
|
|
import django.db.models.deletion
|
|
import treenode.models.mixins.properties
|
|
import uuid
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='DirectoryType',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('code', models.CharField(max_length=50, unique=True, verbose_name='Код типа')),
|
|
('name', models.CharField(max_length=100, verbose_name='Название типа')),
|
|
('description', models.TextField(blank=True, verbose_name='Описание')),
|
|
('is_active', models.BooleanField(default=True, verbose_name='Активный')),
|
|
('hierarchy_type', models.CharField(choices=[('strict', 'Строгая иерархия (одинаковые типы)'), ('flexible', 'Гибкая иерархия (разные типы)'), ('custom', 'Кастомная иерархия')], default='strict', max_length=10, verbose_name='Тип иерархии')),
|
|
('allowed_child_types', models.ManyToManyField(blank=True, help_text='Только для гибкой и кастомной иерархии', to='core.directorytype', verbose_name='Разрешенные типы потомков')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Тип справочника',
|
|
'verbose_name_plural': 'Типы справочников',
|
|
'ordering': ['name'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Directory',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('priority', models.PositiveIntegerField(default=0, verbose_name='priority')),
|
|
('_path', models.TextField(default='', editable=False)),
|
|
('_depth', models.PositiveIntegerField(default=0, editable=False)),
|
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('code', models.CharField(max_length=100, verbose_name='Код')),
|
|
('name', models.CharField(max_length=255, verbose_name='Название')),
|
|
('description', models.TextField(blank=True, verbose_name='Описание')),
|
|
('is_active', models.BooleanField(default=True, verbose_name='Активный')),
|
|
('extra_data', models.JSONField(blank=True, default=dict, verbose_name='Дополнительные данные')),
|
|
('ad_group_dn', models.CharField(blank=True, help_text='Distinguished Name группы в Active Directory (например: CN=IT_Department,OU=Groups,DC=company,DC=local). Только для отделов.', max_length=500, verbose_name='AD Group DN')),
|
|
('location_types', models.ManyToManyField(blank=True, help_text='Для должностей: в каких типах локаций доступна эта должность', limit_choices_to={'directory_type__code': 'location_type', 'is_active': True}, related_name='available_posts', to='core.directory', verbose_name='Типы локаций')),
|
|
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='core.directory', verbose_name='parent')),
|
|
('directory_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.directorytype', verbose_name='Тип справочника')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Элемент справочника',
|
|
'verbose_name_plural': 'Элементы справочников',
|
|
'indexes': [models.Index(fields=['directory_type', 'is_active'], name='core_direct_directo_dc8bea_idx'), models.Index(fields=['parent', 'directory_type'], name='core_direct_parent__7564e7_idx'), models.Index(fields=['is_active'], name='core_direct_is_acti_15f1b0_idx'), models.Index(fields=['_path'], name='idx_directory_path_ops', opclasses=['text_pattern_ops'])],
|
|
'unique_together': {('directory_type', 'code')},
|
|
},
|
|
bases=(treenode.models.mixins.properties.TreeNodePropertiesMixin, models.Model),
|
|
),
|
|
]
|