Cache new request form data

This commit is contained in:
richard-dds 2018-11-15 16:03:40 -05:00
parent a475cb3156
commit 365a600152
2 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,7 @@ from atst.domain.requests.financial_verification import (
)
from atst.models.attachment import Attachment
from atst.domain.task_orders import TaskOrders
from atst.utils.form_cache import retrieve_form_data
from atst.utils.form_cache import FormCache
def fv_extended(_http_request):
@ -95,7 +95,7 @@ class FinancialVerificationBase(object):
def existing_form_data():
key = http_request.args.get("formCache")
if key:
return retrieve_form_data(app.redis, key)
return FormCache(app.redis).read(key)
class GetFinancialVerificationForm(FinancialVerificationBase):

View File

@ -1,4 +1,4 @@
from flask import g, redirect, render_template, url_for, request as http_request
from flask import g, redirect, render_template, url_for, request as http_request, current_app
from . import requests_bp
from atst.domain.requests import Requests
@ -29,7 +29,8 @@ def option_data():
@requests_bp.route("/requests/new/<int:screen>", methods=["GET"])
def requests_form_new(screen):
jedi_flow = JEDIRequestFlow(screen, request=None, current_user=g.current_user)
cached_data = current_app.form_cache.from_request(http_request)
jedi_flow = JEDIRequestFlow(screen, request=None, current_user=g.current_user, post_data=cached_data)
return render_template(
"requests/screen-%d.html" % int(screen),