Add an item Date${h.form.date_field('date', last_entry[0].strftime('%d/%m/%Y') if last_entry and last_entry[0] else '', e, id='date')} Title${h.form.text_field('title', '', e, id='title', autofocus='autofocus')} Amount${h.form.number_field('amount', '', e, id='amount', step='any')} Category${h.form.text_field('category', '', e, id='category')} Tags${h.form.text_field('tags', '', e, id='tags')} Direction${h.form.radio('direction', 'in', e, label='In')}${h.form.radio('direction', 'out', e, label='Out', checked=True)}${h.form.radio('direction', 'internal', e, label='Internal transfer')} Don't add ${h.form.submit('Add', class_='button')}