Don't redirect after saving draft
This commit is contained in:
parent
2b07491c47
commit
f291450962
@ -240,15 +240,16 @@ def update_financial_verification(request_id):
|
|||||||
|
|
||||||
@requests_bp.route("/requests/verify/<string:request_id>/draft", methods=["POST"])
|
@requests_bp.route("/requests/verify/<string:request_id>/draft", methods=["POST"])
|
||||||
def save_financial_verification_draft(request_id):
|
def save_financial_verification_draft(request_id):
|
||||||
request = Requests.get(g.current_user, request_id)
|
user = g.current_user
|
||||||
|
request = Requests.get(user, request_id)
|
||||||
fv_data = {**http_request.form, **http_request.files}
|
fv_data = {**http_request.form, **http_request.files}
|
||||||
is_extended = fv_extended(http_request)
|
is_extended = fv_extended(http_request)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
SaveFinancialVerificationDraft(
|
updated_request = SaveFinancialVerificationDraft(
|
||||||
PENumberValidator(),
|
PENumberValidator(),
|
||||||
TaskOrderNumberValidator(),
|
TaskOrderNumberValidator(),
|
||||||
g.current_user,
|
user,
|
||||||
request,
|
request,
|
||||||
fv_data,
|
fv_data,
|
||||||
is_extended=is_extended,
|
is_extended=is_extended,
|
||||||
@ -261,4 +262,14 @@ def save_financial_verification_draft(request_id):
|
|||||||
extended=is_extended,
|
extended=is_extended,
|
||||||
)
|
)
|
||||||
|
|
||||||
return redirect(url_for("requests.requests_index"))
|
form = GetFinancialVerificationForm(
|
||||||
|
user, updated_request, is_extended=is_extended
|
||||||
|
).execute()
|
||||||
|
return render_template(
|
||||||
|
"requests/financial_verification.html",
|
||||||
|
f=form,
|
||||||
|
jedi_request=request,
|
||||||
|
review_comment=request.review_comment,
|
||||||
|
extended=is_extended,
|
||||||
|
saved_draft=True,
|
||||||
|
)
|
||||||
|
@ -42,6 +42,11 @@
|
|||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if saved_draft %}
|
||||||
|
{% call Alert('Draft saved', level='info') %}
|
||||||
|
{% endcall %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<form autocomplete="off" enctype="multipart/form-data">
|
<form autocomplete="off" enctype="multipart/form-data">
|
||||||
|
|
||||||
{{ f.csrf_token }}
|
{{ f.csrf_token }}
|
||||||
|
@ -17,7 +17,6 @@ from atst.domain.requests.financial_verification import (
|
|||||||
PENumberValidator,
|
PENumberValidator,
|
||||||
TaskOrderNumberValidator,
|
TaskOrderNumberValidator,
|
||||||
)
|
)
|
||||||
from atst.utils import pick
|
|
||||||
from atst.models.request_status_event import RequestStatus
|
from atst.models.request_status_event import RequestStatus
|
||||||
from atst.domain.requests.query import RequestsQuery
|
from atst.domain.requests.query import RequestsQuery
|
||||||
|
|
||||||
@ -199,11 +198,16 @@ def test_save_draft_allows_invalid_data():
|
|||||||
data = {
|
data = {
|
||||||
"task_order-number": MANUAL_TO_NUMBER,
|
"task_order-number": MANUAL_TO_NUMBER,
|
||||||
"request-pe_id": "123",
|
"request-pe_id": "123",
|
||||||
"request-ba_code": "a"
|
"request-ba_code": "a",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert SaveFinancialVerificationDraft(
|
assert SaveFinancialVerificationDraft(
|
||||||
PENumberValidator(), TaskOrderNumberValidator(), user, request, data, is_extended=True
|
PENumberValidator(),
|
||||||
|
TaskOrderNumberValidator(),
|
||||||
|
user,
|
||||||
|
request,
|
||||||
|
data,
|
||||||
|
is_extended=True,
|
||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
|
|
||||||
@ -267,17 +271,6 @@ def test_update_ignores_empty_values(fv_data, e_fv_data):
|
|||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
|
|
||||||
def test_simple_form_does_not_generate_task_order(fv_data):
|
|
||||||
request = RequestFactory.create()
|
|
||||||
user = UserFactory.create()
|
|
||||||
data = pick(["uii_ids"], fv_data)
|
|
||||||
updated_request = SaveFinancialVerificationDraft(
|
|
||||||
TrueValidator, TrueValidator, user, request, data, is_extended=False
|
|
||||||
).execute()
|
|
||||||
|
|
||||||
assert updated_request.task_order is None
|
|
||||||
|
|
||||||
|
|
||||||
def test_can_save_draft_with_funding_type(fv_data, e_fv_data):
|
def test_can_save_draft_with_funding_type(fv_data, e_fv_data):
|
||||||
request = RequestFactory.create()
|
request = RequestFactory.create()
|
||||||
user = UserFactory.create()
|
user = UserFactory.create()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user