Here is the app I presented at today’s Anvil User Group meeting! It’s a pretty simple TODO-list app, but it’s implemented entirely with Model Classes (look ma, no Server Modules!).
Clone it here to take a look: Anvil | Login
Notable features:
- There are no Server Modules! All privileged operations happen via the model (including a
@server_method
) - All security and access control is in the model
- The
is_overdue
property on the model class separates the logic (what counts as an overdue task) from the presentation (display overdue tasks in red - which happens in the data bindings of the row template) - The model is client-writable, so all the DB updates happen directly in client code
- Buffering to edit items or draft new items
I’d suggest starting with the Models
module, then working your way through Form1
, then the row template in the DataGrid, then EditItem itself (which is 100% data bindings and no other code).
If you have any questions, feel free to ask!