Skip to content

Struggling to get data from SeaOrm to render in Handlebars #559

Answered by sunng87
dave42w asked this question in Q&A
Discussion options

You must be logged in to vote

data: {"place": [[Model { id: 1, name: "London" }, Model { id: 2, name: "Paris" }, Model { id: 3, name: "New York" }, Model { id: 4, name: "New York" }, Model { id: 5, name: "York" }]]}

You seem to wrap places in nested vectors, try to fix it like this:

let mut data = BTreeMap::new();
// use places directly
data.insert("place".to_string(), places);
println!("data: {:?}", data);
s.templates.render("place_list.html", &data).unwrap().into()

And you cannot serialize your data to json to render in handlebars because we only use the json type system not the format.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dave42w
Comment options

Answer selected by dave42w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants