display success alert when user updates profile info
This commit is contained in:
parent
84d091fcf1
commit
65bc05d214
@ -61,7 +61,7 @@ class EditUserForm(ValidatedForm):
|
||||
lower_bound=pendulum.duration(years=1),
|
||||
upper_bound=pendulum.duration(days=0),
|
||||
message="Must be a date within the last year.",
|
||||
),
|
||||
)
|
||||
],
|
||||
format="%m/%d/%Y",
|
||||
)
|
||||
|
@ -1,11 +1,4 @@
|
||||
from flask import (
|
||||
Blueprint,
|
||||
render_template,
|
||||
g,
|
||||
redirect,
|
||||
url_for,
|
||||
request as http_request,
|
||||
)
|
||||
from flask import Blueprint, render_template, g, request as http_request
|
||||
from atst.forms.edit_user import EditUserForm
|
||||
from atst.domain.users import Users
|
||||
|
||||
@ -24,8 +17,9 @@ def user():
|
||||
def update_user():
|
||||
user = g.current_user
|
||||
form = EditUserForm(http_request.form)
|
||||
rerender_args = {"form": form, "user": user}
|
||||
if form.validate():
|
||||
Users.update(user, form.data)
|
||||
return redirect(url_for("atst.home"))
|
||||
else:
|
||||
return render_template("user/edit.html", form=form, user=user)
|
||||
rerender_args["updated"] = True
|
||||
|
||||
return render_template("user/edit.html", **rerender_args)
|
||||
|
@ -1,8 +1,13 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "components/alert.html" import Alert %}
|
||||
|
||||
{% block content %}
|
||||
<div class='col'>
|
||||
|
||||
{% if updated %}
|
||||
{{ Alert('User information updated.', level='success') }}
|
||||
{% endif %}
|
||||
|
||||
<div class='panel'>
|
||||
<div class='panel__heading'>
|
||||
<h1>
|
||||
|
Loading…
x
Reference in New Issue
Block a user