diff --git a/app/templates/macros/forms.html b/app/templates/macros/forms.html
new file mode 100644
index 00000000..a2b75a7a
--- /dev/null
+++ b/app/templates/macros/forms.html
@@ -0,0 +1,42 @@
+{% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None) -%}
+
+{%- endmacro %}
+
+{% macro render_checkbox_field(field, label=None) -%}
+ {% if not label %}{% set label=field.label.text %}{% endif %}
+
+
+ {{ field(type='checkbox', **kwargs) }} {{ label }}
+
+
+{%- endmacro %}
+
+{% macro render_radio_field(field) -%}
+ {% for value, label, checked in field.iter_choices() %}
+
+
+
+ {{ label }}
+
+
+ {% endfor %}
+{%- endmacro %}
+
+{% macro render_submit_field(field, label=None, tabindex=None) -%}
+ {% if not label %}{% set label=field.label.text %}{% endif %}
+ {#{{label}} #}
+
+{%- endmacro %}
diff --git a/app/templates/users/user_profile_page.html b/app/templates/users/user_profile_page.html
new file mode 100644
index 00000000..0eb6adb5
--- /dev/null
+++ b/app/templates/users/user_profile_page.html
@@ -0,0 +1,72 @@
+{% extends "base.html" %}
+
+{% block title %}
+ {{ user.username }}
+{% endblock %}
+
+{% block content %}
+
+
+
{{ user.username }}
+
+
+
+
+{% if form %}
+ {% from "macros/forms.html" import render_field, render_submit_field %}
+
+{% endif %}
+{% endblock %}
diff --git a/app/views/users.py b/app/views/users.py
index 99cf19c4..1dc5e296 100644
--- a/app/views/users.py
+++ b/app/views/users.py
@@ -13,17 +13,11 @@ from flask_user.forms import RegisterForm
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, validators
class MyRegisterForm(RegisterForm):
- first_name = StringField('First name', validators=[
- validators.DataRequired('First name is required')])
- last_name = StringField('Last name', validators=[
- validators.DataRequired('Last name is required')])
+ display_name = StringField("Diplay name")
# Define the User profile form
class UserProfileForm(FlaskForm):
- first_name = StringField('First name', validators=[
- validators.DataRequired('First name is required')])
- last_name = StringField('Last name', validators=[
- validators.DataRequired('Last name is required')])
+ display_name = StringField("Diplay name")
submit = SubmitField('Save')
@app.route('/user/', methods=['GET', 'POST'])
@@ -42,7 +36,7 @@ def user_profile_page(username=None):
if user == current_user:
# Initialize form
- form = UserProfileForm(request.form, current_user)
+ form = UserProfileForm(formdata=request.form, obj=current_user)
# Process valid POST
if request.method=='POST' and form.validate():