- Added departments ManyToMany field to Document model - Implemented department selection in document create/edit modals - Added automatic notification creation for all department employees - Fixed document filtering to include uploaded documents in 'My Documents' - Fixed acknowledgements API to include department recipients - Added bulk notification support with configurable threshold - Removed acknowledge button, added visual highlighting for unread documents - Implemented server-side acknowledgment flow with redirect to file - Fixed mobile responsive layout for document actions - Removed temporary test files and documentation
32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""
|
||
Тестовый view для создания уведомлений
|
||
"""
|
||
from django.http import JsonResponse
|
||
from django.contrib.auth.decorators import login_required
|
||
from notifications.services import NotificationService
|
||
|
||
|
||
@login_required
|
||
def create_test_notification(request):
|
||
"""Создать тестовое уведомление для текущего пользователя"""
|
||
notification = NotificationService.create_notification(
|
||
recipient=request.user,
|
||
notification_type_code='system_announcement',
|
||
title='🎉 Тестовое уведомление',
|
||
message='Это тестовое сообщение отправлено через API. Вы должны увидеть toast!',
|
||
action_url='/notifications/',
|
||
action_text='Открыть уведомления'
|
||
)
|
||
|
||
if notification:
|
||
return JsonResponse({
|
||
'success': True,
|
||
'notification_id': notification.id,
|
||
'message': 'Уведомление создано и отправлено'
|
||
})
|
||
else:
|
||
return JsonResponse({
|
||
'success': False,
|
||
'message': 'Не удалось создать уведомление'
|
||
}, status=400)
|