-
Notifications
You must be signed in to change notification settings - Fork 282
Description
Describe the bug
After PR #740 (merged May 29, 2025) a title named parameter was added to fast_app() (to set a default page title). That name collides with the very common pattern of passing title=str to fast_app(...) to define a title column for the generated DB table. Because title is now an explicit parameter it is consumed by the function signature and does not end up in the **kwargs used to build the DB schema, so the title column is not created. This breaks many examples that use title=str (docs, tutorials, videos, examples).
Minimal Reproducible Example
1. Delete any existing DB at data/todos.db.
2. Create main.py with:
from fasthtml.common import *
app,rt,todos,Todo = fast_app(
'data/todos.db',
id=int, pk='id', title=str, done=bool)
@rt('/')
def get():
todos.insert(Todo(title='First Todo', done=False))
items = todos()
return Titled('Todos',
Div(*items)
)
serve()
- Run python main.py then check the SQLite schema:
sqlite3 data/todos.db "PRAGMA table_info('items');"
title will not be present as a column.
Also, when the user loads the app, they encounter an Internal Server Error.
The server errors with:
TypeError: Items.init() got an unexpected keyword argument 'title'
Expected behavior
Passing title=str to fast_app(...) should create a title column in the items table (same as task=str or name=str).
When the user loads the app, they see the new task.
Environment Information
Please provide the following version information:
- fasthtml version: latest
Confirmation
Please confirm the following:
- I have read the FAQ (https://fastht.ml/docs/explains/faq.html)
- I have provided a minimal reproducible example
- I have included the versions of fastlite, fastcore, and fasthtml
- I understand that this is a volunteer open source project with no commercial support.