Corp/backend/scripts/utils/render_test_page.py
Игорь Надеин ee6e840252 Реорганизация документации и скриптов проекта
- Создана структура docs/ с категориями: completed, guides, architecture, diagnostic, in-progress, reports
- Перемещено 47+ MD файлов из корня проекта в docs/
- Удалено 6 устаревших/дублирующихся файлов
- Создана структура backend/scripts/ для тестов и утилит
- Перемещено 35 Python скриптов в backend/scripts/
- Создана структура backend/docs/ для технической документации
- Перемещено 12 MD файлов backend в backend/docs/
- Перемещены LDAP тестовые данные в backend/tests/fixtures/
- Добавлены README файлы для навигации
- Добавлены правила в .github/copilot-instructions.md для размещения документации

Результат:
- Корень проекта: только README.md
- Корень backend/: только manage.py и Django приложения
- Вся документация организована в структурированные папки
2025-12-26 13:49:51 +03:00

57 lines
1.9 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.

#!/usr/bin/env python
"""
Создаёт HTML файл с рендером страницы отдела для проверки.
"""
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eusrr_backend.settings')
import django
django.setup()
from django.template import loader, Context
from django.contrib.auth import get_user_model
from employees.models import Department
from django.test import RequestFactory
User = get_user_model()
# Получаем отдел и пользователя
dept = Department.objects.filter(id=16).first()
if not dept:
dept = Department.objects.first()
user = User.objects.filter(is_superuser=True).first()
if not dept or not user:
print("Нет данных для рендеринга")
exit(1)
# Создаём request
factory = RequestFactory()
request = factory.get(f'/employees/departments/{dept.id}/')
request.user = user
# Получаем view context
from employees.views_front import department_detail
response = department_detail(request, pk=dept.id)
# Сохраняем HTML
output_file = 'department_page_render.html'
with open(output_file, 'wb') as f:
f.write(response.content)
print(f"✓ Страница сохранена в {output_file}")
print(f" Размер: {len(response.content)} байт")
# Анализ содержимого
html = response.content.decode('utf-8')
print(f"\nАнализ:")
print(f" <style> тегов: {html.count('<style>')}")
print(f" <script> тегов: {html.count('<script>')}")
print(f" .team-wheel: {'✓' if '.team-wheel' in html else '✗'}")
print(f" .calendar-wrap: {'✓' if '.calendar-wrap' in html else '✗'}")
print(f" initTeamWheel: {'✓' if 'initTeamWheel' in html else '✗'}")
print(f" FullCalendar: {'✓' if 'FullCalendar' in html else '✗'}")
print(f" dropdown-toggle: {'✓' if 'dropdown-toggle' in html else '✗'}")
print(f" Bootstrap JS: {'✓' if 'bootstrap.bundle.min.js' in html else '✗'}")