Skip to content
Snippets Groups Projects
Commit bb89d429 authored by kaiyou's avatar kaiyou
Browse files

List user contact info in details page

parent 066c7d8c
No related branches found
No related tags found
Loading
from hiboo.account import blueprint, forms
from hiboo import models, security
from wtforms import fields
from flask_babel import lazy_gettext as _
import flask
......@@ -30,7 +31,10 @@ def contact():
user = flask_login.current_user
form = forms.ContactForm()
if form.validate_on_submit():
user.contact = form.data
user.contact = {
field.name: form.data[field.name] for field in form
if type(field) is fields.StringField
}
models.db.session.add(user)
models.db.session.commit()
flask.flash(_("Successfully updated your contact info"), "success")
......
......@@ -17,6 +17,11 @@
<dt>{% trans %}Created at{% endtrans %}</dt>
<dd>{{ user.created_at }}</dd>
{% for name, value in user.contact.items() %}
<dt>{{ name | capitalize }}</dt>
<dd>{{ value }}</dd>
{% endfor %}
</dl>
</div>
</div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment