Files
ACORE/apps/hiring/migrations/0002_seed_access_systems.py
T
lokses 6ff01c4119 Доменные модули: сотрудники, локации, найм, счётчики, посещения
- employees: last_seen, internal_number, default_page_size; управление-команды
- locations: категория/куратор/ответственный аптеки, seed должностей;
  Location.__str__ показывает номер аптеки (не только адрес)
- hiring: HiringRequest (заявки на найм) + тесты (7)
- utilities: UtilityReading (показания счётчиков по аптекам)
- visit_manager: правки

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 17:33:16 +03:00

43 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from django.db import migrations
from pytils.translit import slugify
ACCESS_SYSTEMS = [
'1С: Бухгалтерія',
'1С: Управління торгівлею',
'1С: ЗУП',
'Пошта',
'Mattermost',
'CRM',
]
def forwards(apps, schema_editor):
DirectoryType = apps.get_model('core', 'DirectoryType')
Directory = apps.get_model('core', 'Directory')
directory_type, _ = DirectoryType.objects.get_or_create(
code='access_system',
defaults={'name': 'Система доступу', 'hierarchy_type': 'strict'},
)
for name in ACCESS_SYSTEMS:
Directory.objects.get_or_create(
directory_type=directory_type, name=name,
defaults={'is_active': True, 'code': slugify(name)},
)
def backwards(apps, schema_editor):
DirectoryType = apps.get_model('core', 'DirectoryType')
DirectoryType.objects.filter(code='access_system').delete()
class Migration(migrations.Migration):
dependencies = [
('hiring', '0001_initial'),
]
operations = [
migrations.RunPython(forwards, backwards),
]