from notion_client import Client
from basic_notion.query import Query
from basic_notion.page import NotionPage, NotionPageList
from basic_notion.block import NotionBlock, ToDoBlock, TextListField
from basic_notion.field import SelectField, TitleField, MultiSelectField, UrlField
class PageBlock(NotionBlock):
to_do = ToDoBlock()
class MyRow(NotionPage):
name = TitleField(property_name='Задача | Проект')
doing = SelectField(property_name='Выполнение')
tags = MultiSelectField(property_name='Tags')
link = UrlField(property_name='Ссылка')
class MyData(NotionPageList[MyRow]):
ITEM_CLS = MyRow
def get_data(database_id: str) -> MyData:
client = Client(auth=NOTION_TOKEN)
data = client.databases.query(
**Query(database_id=database_id).filter(
MyRow.name.filter.is_not_empty(True)
).serialize()
)
return MyData(data=data)
def create_page(database_id: str) -> MyRow:
client = Client(auth=NOTION_TOKEN)
page = MyRow.make(
parent={'database_id': database_id},
children = PageBlock.make(
to_do = 'Сделать тест'
),
name = ['TestPage'],
doing = 'Слежу',
tags = ['На проверке'],
link = 'wildberries.com'
)
response = client.pages.create(**page.data)
item = MyRow(data=response)
return item
create_page(DATABASE_ID)
how to fix it?
i tried to put page to the table with to do blocks