refactored database model

This commit is contained in:
Hosein
2026-01-05 14:30:25 +03:30
parent 8680778584
commit 4b5b24c97c
4 changed files with 236 additions and 558 deletions
+2 -1
View File
@@ -3,7 +3,8 @@ from database.models import Categories
from bot.handlers.start import startMarkup
from bot.utils.crud_helpers import create_entity_markup
# TODO: Add Option for showing courses with specific tags.
# TODO: Add Option for showing parent categories when creating a new category.
# TODO: Show Some of the courses of a Category.
def register(bot: TeleBot):
+2 -2
View File
@@ -41,7 +41,7 @@ def register(bot: TeleBot):
@bot.callback_query_handler(func=lambda call: call.data.startswith('teacher_'))
def show_teacher_details(call):
teacher_id = call.data.split('_')[1]
teacher = Teachers.getTeachertById(teacher_id)
teacher = Teachers.getTeacherById(teacher_id)
if teacher:
details = format_teacher_info(teacher)
@@ -101,7 +101,7 @@ def register(bot: TeleBot):
@bot.callback_query_handler(func=lambda call: call.data.startswith('edit_teacher_'))
def start_teacher_editing(call):
teacher_id = call.data.split('_')[2]
teacher = Teachers.getTeachertById(teacher_id)
teacher = Teachers.getTeacherById(teacher_id)
if not teacher:
bot.send_message(call.message.chat.id, "Teacher not found.")