Skip to content

Commit f6f5073

Browse files
committed
fix: rename 'title' DB field to 'task' to avoid fast_app() title kwarg collision
1 parent 2822154 commit f6f5073

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

demo/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
def render(item:'Todo'):
44
id = f'todo-{item.id}'
55
dellink = AX('Delete', hx_delete=f'/todo/{item.id}', target_id=id, hx_swap='delete')
6-
return Li(item.title, dellink, id=id)
6+
return Li(item.task, dellink, id=id)
77

88
auth = user_pwd_auth(user='s3kret', skip=[r'/favicon\.ico', r'/static/.*', r'.*\.css'])
99
app,rt,todos,Todo = fast_app(
1010
'data/tbl.db', middleware=[auth], render=render,
11-
id=int, title=str, pk='id')
11+
id=int, task=str, pk='id')
1212

1313
@rt("/")
1414
async def get(request):
1515
new_frm = Form(hx_post='/', target_id='todo-list', hx_swap='beforeend')(
1616
Group(
17-
Input(name='title', placeholder='Title'),
17+
Input(name='task', placeholder='Task'),
1818
Button('Add')
1919
)
2020
)

0 commit comments

Comments
 (0)