def order_estimate(order_id): expert_list = [(expert['id'], expert['nazwa']) for expert in model.experts()] estimate_order_form = forms.EstimateOrderForm.feed_with_experts(request.form, expert_list) if request.method == 'POST' and estimate_order_form.validate(): try: model.create_estimate_order(order_id, estimate_order_form.expert.data) except model.DatabaseError: raise werkzeug.exceptions.Forbidden("Zlecenie wykonania kosztorysu już istnieje!") else: return redirect('/') return render_template('estimate_order.html', order_id=order_id, estimate_order_form=estimate_order_form)
def experts(): experts = model.experts() return render_template('experts.html', experts=experts)