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>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
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),
|
||
]
|