diff --git a/src/schooling/signals_bot.py b/src/schooling/signals_bot.py index 0d51b53..d21ecc1 100644 --- a/src/schooling/signals_bot.py +++ b/src/schooling/signals_bot.py @@ -241,29 +241,26 @@ async def delete_lesson_and_send_msg(sender, instance, *args, **kwargs): instance.datetime_start, instance.datetime_end) chat_ids = ( - instance.student_id.telegram_id, - instance.teacher_id.telegram_id, + await sync_to_async(lambda: instance.student_id.telegram_id)(), + await sync_to_async(lambda: instance.teacher_id.telegram_id)(), ) message_text = ( f'Занятие на тему "{instance.name}" ' f'на {start_time_formatted}, ' - f'продолжительностью {duration} минут.' - f'{instance.datetime_end.time()} отменено.' + f'продолжительностью {duration} минут. ' + f'Отменено.' ) + if instance.teacher_id.telegram_id: - reply_markup = await get_root_markup( - instance.teacher_id.telegram_id, - ) + reply_markup = await get_root_markup(instance.teacher_id.telegram_id) else: - reply_markup = await get_root_markup( - instance.student_id.telegram_id, - ) + reply_markup = await get_root_markup(instance.student_id.telegram_id) await gather_send_messages_to_users( - chat_ids=chat_ids, - message_text=message_text, - reply_markup=reply_markup, - ) + chat_ids=chat_ids, + message_text=message_text, + reply_markup=reply_markup, + ) async def get_schedule_for_role(user):