Advertisement
ivandev

Untitled

Jan 11th, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
  2.  
  3. from keyboards.inline.callback_data import choose_field_callback
  4. from loader import loop
  5. from utils.db_api.db_commands import select_all_fields
  6.  
  7. # fields = select_all_fields()
  8. # fields = loop.run_until_complete(fields)
  9. #
  10. # choose_field_keyboard = InlineKeyboardMarkup(row_width=1)
  11. # for field in fields:
  12. #     choose_field_keyboard.insert(InlineKeyboardButton(text=f"{field.name}", callback_data=choose_field_callback.new(field.id)))
  13.  
  14.  
  15. async def choose_field_keyboard():
  16.     fields = await select_all_fields()
  17.     keyboard = InlineKeyboardMarkup(row_width=1)
  18.     for field in fields:
  19.         keyboard.insert(InlineKeyboardButton(text=f"{field.name}", callback_data=choose_field_callback.new(field.id)))
  20.     return keyboard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement