diff --git a/app/templates/orders.html b/app/templates/orders.html index d764d07..4673a78 100644 --- a/app/templates/orders.html +++ b/app/templates/orders.html @@ -1,9 +1,10 @@ {% extends 'layout.html' %} {% set active_page = "orders" -%} +{% import "bootstrap/wtf.html" as wtf %} {% block container %}
-
+

Open orders:

    {% for order in orders %} @@ -11,8 +12,9 @@ {% endfor %}
-
- Create new order +
+ {{ wtf.quick_form(form, action=url_for('order_create'), button_map={'submit_button': 'primary'}, form_type='horizontal') }} +
{% endblock %} \ No newline at end of file diff --git a/app/views.py b/app/views.py index 879019e..78a573b 100644 --- a/app/views.py +++ b/app/views.py @@ -45,8 +45,7 @@ def order_create(): orderForm.populate_obj(order) db.session.add(order) db.session.commit() - print(order.id) - return redirect(url_for('home')) + return redirect(url_for('order', id=order.id)) return render_template('order_form.html', form=orderForm) @@ -54,7 +53,9 @@ def order_create(): @login_required def orders(): orders = Order.query.filter((Order.stoptime > datetime.now()) | (Order.stoptime == None)).all() - return render_template('orders.html', orders=orders) + orderForm = OrderForm() + orderForm.populate() + return render_template('orders.html', orders=orders, form=orderForm) if app.debug: # add route information