Refactor form action for new task order templates
This commit is contained in:
parent
12706c3d45
commit
772ca75688
@ -215,6 +215,12 @@ def new(screen, task_order_id=None, portfolio_id=None):
|
||||
"complete": workflow.is_complete,
|
||||
}
|
||||
|
||||
url_args = {"screen": screen}
|
||||
if task_order_id:
|
||||
url_args["task_order_id"] = task_order_id
|
||||
else:
|
||||
url_args["portfolio_id"] = portfolio_id
|
||||
|
||||
if workflow.task_order:
|
||||
template_args["task_order"] = workflow.task_order
|
||||
if http_request.args.get("ko_edit"):
|
||||
@ -224,6 +230,9 @@ def new(screen, task_order_id=None, portfolio_id=None):
|
||||
portfolio_id=workflow.task_order.portfolio.id,
|
||||
task_order_id=task_order_id,
|
||||
)
|
||||
url_args["next"] = template_args["next"]
|
||||
|
||||
template_args["action_url"] = url_for("task_orders.update", **url_args)
|
||||
|
||||
return render_template(workflow.template, **template_args)
|
||||
|
||||
|
@ -9,15 +9,7 @@
|
||||
{% include "fragments/flash.html" %}
|
||||
|
||||
{% block form_action %}
|
||||
{% if ko_edit %}
|
||||
<form method='POST' action="{{ url_for('task_orders.update', screen=current, task_order_id=task_order_id, next=next) }}" autocomplete="off" enctype="multipart/form-data">
|
||||
{% endif %}
|
||||
|
||||
{% if task_order_id %}
|
||||
<form method='POST' action="{{ url_for('task_orders.new', screen=current, task_order_id=task_order_id) }}" autocomplete="off" enctype="multipart/form-data">
|
||||
{% else %}
|
||||
<form method='POST' action="{{ url_for('task_orders.update', screen=current, portfolio_id=portfolio_id) }}" autocomplete="off" enctype="multipart/form-data">
|
||||
{% endif %}
|
||||
<form method='POST' action="{{ action_url }}" autocomplete="off" enctype="multipart/form-data">
|
||||
{% endblock %}
|
||||
|
||||
<div class="panel">
|
||||
|
Loading…
x
Reference in New Issue
Block a user