Skip to content

Instantly share code, notes, and snippets.

@calpaterson
Forked from molszewski/validate_sample.py
Created February 15, 2014 20:57
Show Gist options
  • Save calpaterson/9025144 to your computer and use it in GitHub Desktop.
Save calpaterson/9025144 to your computer and use it in GitHub Desktop.
@app.route("/claims/new-employment-end-date", methods=["POST"])
def new_employment_end_date():
def on_success(validated):
draft_id = session.get('draft_id')
day = validated['new_job_end']['day']
month = validated['new_job_end']['month']
year = validated['new_job_end']['year']
date = "{day}/{month}/{year}".format(**locals())
claim_service.update_draft(draft_id, {
"new_job_end_date": date
})
return redirect('/claims/summary')
def on_error(form_data, errors):
return render_template("new_employment_end_date.html", form_data=form_data, errors=errors)
return validate(schemas.NewEmploymentEndDate(), on_success, on_error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment