78475b58e9
- acore: Celery-приложение (брокер из env, eager без брокера), настройки CELERY_*, регистрация всех новых приложений в INSTALLED_APPS, маршруты - core/utils: render_page (HTMX-фрагмент/полный layout), is_owner/ is_owner_or_staff; templatetags common_tags (initials, clean_excerpt, is_it_staff); UpdateLastSeenMiddleware - static: people-picker (дерево отделов с аватарками), searchable-select (одиночный выбор с поиском), directory-quick-add, it-manager, pagination; тема Tailwind v4 пересобрана, лого - templates: новый шелл index.html (мобильный сайдбар, темы, фон, user-dropdown) и login с брендингом Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
16 lines
768 B
Python
16 lines
768 B
Python
from django.shortcuts import render
|
||
|
||
|
||
def is_htmx_request(request) -> bool:
|
||
"""Запрос прислан HTMX (hx-get/hx-post), а не обычной навигацией браузера"""
|
||
return request.headers.get('HX-Request') == 'true'
|
||
|
||
|
||
def render_page(request, page_template: str, context: dict = None):
|
||
"""Страница портала: HTMX-фрагмент из pages/<page_template> или полный
|
||
layout (index.html) с этим же фрагментом внутри — по типу запроса."""
|
||
context = context or {}
|
||
if is_htmx_request(request):
|
||
return render(request, f'pages/{page_template}', context)
|
||
return render(request, 'index.html', {'page_template': f'pages/{page_template}', **context})
|