Formatting
This commit is contained in:
@@ -5,6 +5,7 @@ from atst.domain.requests import Requests
|
||||
|
||||
bp = Blueprint("atst", __name__)
|
||||
|
||||
|
||||
@bp.route("/")
|
||||
def home():
|
||||
return render_template("home.html")
|
||||
|
@@ -8,6 +8,7 @@ from atst.forms.financial import FinancialForm
|
||||
|
||||
requests_bp = Blueprint("requests", __name__)
|
||||
|
||||
|
||||
def map_request(user, request):
|
||||
time_created = pendulum.instance(request.time_created)
|
||||
is_new = time_created.add(days=1) > pendulum.now()
|
||||
@@ -25,7 +26,10 @@ def map_request(user, request):
|
||||
@requests_bp.route("/requests", methods=["GET"])
|
||||
def requests_index():
|
||||
requests = []
|
||||
if "review_and_approve_jedi_workspace_request" in g.current_user["atat_permissions"]:
|
||||
if (
|
||||
"review_and_approve_jedi_workspace_request"
|
||||
in g.current_user["atat_permissions"]
|
||||
):
|
||||
requests = Requests.get_many()
|
||||
else:
|
||||
requests = Requests.get_many(creator_id=g.current_user["id"])
|
||||
@@ -53,9 +57,10 @@ def requests_form_update(screen=1, request_id=None):
|
||||
current=screen,
|
||||
next_screen=screen + 1,
|
||||
request_id=request_id,
|
||||
can_submit=jedi_flow.can_submit
|
||||
can_submit=jedi_flow.can_submit,
|
||||
)
|
||||
|
||||
|
||||
@requests_bp.route("/requests/new/<int:screen>/<string:request_id>", methods=["POST"])
|
||||
def requests_update(screen=1, request_id=None):
|
||||
screen = int(screen)
|
||||
@@ -87,28 +92,26 @@ def requests_update(screen=1, request_id=None):
|
||||
where = "/requests"
|
||||
else:
|
||||
where = url_for(
|
||||
"requests.requests_form_update", screen=jedi_flow.next_screen, request_id=jedi_flow.request_id
|
||||
"requests.requests_form_update",
|
||||
screen=jedi_flow.next_screen,
|
||||
request_id=jedi_flow.request_id,
|
||||
)
|
||||
return redirect(where)
|
||||
else:
|
||||
return render_template(
|
||||
"requests/screen-%d.html" % int(screen),
|
||||
**rerender_args
|
||||
"requests/screen-%d.html" % int(screen), **rerender_args
|
||||
)
|
||||
else:
|
||||
return render_template(
|
||||
"requests/screen-%d.html" % int(screen),
|
||||
**rerender_args
|
||||
)
|
||||
|
||||
|
||||
return render_template("requests/screen-%d.html" % int(screen), **rerender_args)
|
||||
|
||||
|
||||
@requests_bp.route("/requests/verify/<string:request_id>", methods=["GET"])
|
||||
def financial_verification(request_id=None):
|
||||
request = Requests.get(request_id)
|
||||
form = FinancialForm(data=request.body.get('financial_verification'))
|
||||
return render_template("requests/financial_verification.html", f=form, request_id=request_id)
|
||||
form = FinancialForm(data=request.body.get("financial_verification"))
|
||||
return render_template(
|
||||
"requests/financial_verification.html", f=form, request_id=request_id
|
||||
)
|
||||
|
||||
|
||||
@requests_bp.route("/requests/verify/<string:request_id>", methods=["POST"])
|
||||
|
@@ -8,7 +8,6 @@ from atst.forms.poc import POCForm
|
||||
from atst.forms.review import ReviewForm
|
||||
|
||||
|
||||
|
||||
class JEDIRequestFlow(object):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -44,13 +43,10 @@ class JEDIRequestFlow(object):
|
||||
|
||||
def validate_warnings(self):
|
||||
existing_request_data = (
|
||||
self.existing_request
|
||||
and self.existing_request.body.get(self.form_section)
|
||||
self.existing_request and self.existing_request.body.get(self.form_section)
|
||||
) or None
|
||||
|
||||
valid = self.form.perform_extra_validation(
|
||||
existing_request_data,
|
||||
)
|
||||
valid = self.form.perform_extra_validation(existing_request_data)
|
||||
return valid
|
||||
|
||||
@property
|
||||
@@ -77,7 +73,7 @@ class JEDIRequestFlow(object):
|
||||
else:
|
||||
data = self.request.body.get(self.form_section, {})
|
||||
|
||||
return defaultdict(lambda: defaultdict(lambda: 'Input required'), data)
|
||||
return defaultdict(lambda: defaultdict(lambda: "Input required"), data)
|
||||
|
||||
@property
|
||||
def can_submit(self):
|
||||
@@ -120,14 +116,12 @@ class JEDIRequestFlow(object):
|
||||
"title": "Review & Submit",
|
||||
"section": "review_submit",
|
||||
"form": ReviewForm,
|
||||
"show":True,
|
||||
"show": True,
|
||||
},
|
||||
]
|
||||
|
||||
def create_or_update_request(self):
|
||||
request_data = {
|
||||
self.form_section: self.form.data
|
||||
}
|
||||
request_data = {self.form_section: self.form.data}
|
||||
if self.request_id:
|
||||
Requests.update(self.request_id, request_data)
|
||||
else:
|
||||
|
Reference in New Issue
Block a user