1
0
Fork 0

Optional field in template context

This commit is contained in:
Alex Kotov 2020-10-15 22:39:43 +05:00
parent 2b546cd640
commit a7b13ea286
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ use validator::Validate;
#[derive(Serialize)]
struct TemplateContext {
parent: &'static str,
users: Vec<models::User>,
users: Option<Vec<models::User>>,
}
pub fn routes() -> Vec<rocket::Route> {
@ -23,7 +23,7 @@ fn index(db_conn: database::DbConn) -> Template {
let template_context = TemplateContext {
parent: "layout",
users: all_users,
users: Some(all_users),
};
Template::render("index", &template_context)