add sql filter "contains"

This commit is contained in:
Alexander Kalinovsky
2025-02-05 23:35:02 +01:00
parent e24f9e0f79
commit 329c1361a2
6 changed files with 42 additions and 31 deletions

View File

@@ -52,9 +52,7 @@ async def route_callback(message: Message | CallbackQuery, back: bool = True, **
app: "QBotApp" = kwargs["app"]
cmd = app.bot_commands.get(context.user_command.split("&")[0])
await user_handler.cammand_handler(
message=message, cmd=cmd, **kwargs
)
await user_handler.cammand_handler(message=message, cmd=cmd, **kwargs)
else:
raise ValueError(f"Unknown command {context.command}")
else:

View File

@@ -339,7 +339,7 @@ async def process_field_edit_callback(message: Message | CallbackQuery, **kwargs
}
)
cmd=app.bot_commands.get(callback_data.user_command.split("&")[0])
cmd = app.bot_commands.get(callback_data.user_command.split("&")[0])
return await cammand_handler(message=message, cmd=cmd, **kwargs)

View File

@@ -166,12 +166,11 @@ async def entity_item(
)
elif isinstance(button, InlineButton):
if isinstance(button.inline_button, InlineKeyboardButton):
btn_row.append(button.inline_button)
elif callable(button.inline_button):
btn_row.append(button.inline_button(entity_item))
if btn_row:
keyboard_builder.row(*btn_row)
@@ -238,11 +237,19 @@ async def entity_item(
field_caption = get_callable_str(
field_descriptor.caption, field_descriptor, entity_item
)
value = get_value_repr(
value=getattr(entity_item, field_descriptor.name),
field_descriptor=field_descriptor,
locale=user.lang,
)
if field_descriptor.caption_value:
value = get_callable_str(
field_descriptor.caption_value,
field_descriptor,
entity_item,
getattr(entity_item, field_descriptor.field_name),
)
else:
value = get_value_repr(
value=getattr(entity_item, field_descriptor.field_name),
field_descriptor=field_descriptor,
locale=user.lang,
)
item_text += f"\n{field_caption or field_descriptor.name}:{f' <b>{value}</b>' if value else ''}"
context = pop_navigation_context(navigation_stack)

View File

@@ -37,7 +37,9 @@ async def command_text(message: Message, **kwargs):
state_data = await state.get_data()
kwargs["state_data"] = state_data
await process_command_handler(message=message, callback_data=callback_data, **kwargs)
await process_command_handler(
message=message, callback_data=callback_data, **kwargs
)
@router.callback_query(ContextData.filter(F.command == CallbackCommand.USER_COMMAND))
@@ -50,7 +52,6 @@ async def command_callback(message: CallbackQuery, **kwargs):
async def process_command_handler(message: Message | CallbackQuery, **kwargs):
state_data: dict = kwargs["state_data"]
callback_data: ContextData = kwargs["callback_data"]
app: "QBotApp" = kwargs["app"]