diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/web/forms.py | 3 | ||||
-rw-r--r-- | src/web/models/user.py | 3 | ||||
-rw-r--r-- | src/web/templates/profile.html | 3 | ||||
-rw-r--r-- | src/web/templates/profile_public.html | 7 | ||||
-rw-r--r-- | src/web/views/user.py | 3 |
5 files changed, 15 insertions, 4 deletions
diff --git a/src/web/forms.py b/src/web/forms.py index 4770f70c..905a0b2a 100644 --- a/src/web/forms.py +++ b/src/web/forms.py @@ -32,7 +32,7 @@ from flask_babel import lazy_gettext from werkzeug.exceptions import NotFound from wtforms import TextField, TextAreaField, PasswordField, BooleanField, \ SubmitField, IntegerField, SelectField, validators, HiddenField -from flask_wtf.html5 import EmailField +from flask_wtf.html5 import EmailField, URLField from web.lib import misc_utils from web.controllers import UserController @@ -159,6 +159,7 @@ class ProfileForm(Form): validators.Required(lazy_gettext("Please enter your email."))]) password = PasswordField(lazy_gettext("Password")) password_conf = PasswordField(lazy_gettext("Password Confirmation")) + webpage = URLField(lazy_gettext("Webpage")) refresh_rate = IntegerField(lazy_gettext("Feeds refresh frequency " "(in minutes)"), default=60) diff --git a/src/web/models/user.py b/src/web/models/user.py index 3e4ffcac..2e5d2f55 100644 --- a/src/web/models/user.py +++ b/src/web/models/user.py @@ -45,7 +45,10 @@ class User(db.Model, UserMixin, RightMixin): nickname = db.Column(db.String(), unique=True) email = db.Column(db.String(254), index=True, unique=True) pwdhash = db.Column(db.String()) + is_public_profile = db.Column(db.Boolean(), default=False) + webpage = db.Column(db.String(), default="") + date_created = db.Column(db.DateTime(), default=datetime.now) last_seen = db.Column(db.DateTime(), default=datetime.now) refresh_rate = db.Column(db.Integer, default=60) # in minutes diff --git a/src/web/templates/profile.html b/src/web/templates/profile.html index 8751446f..9b5db48a 100644 --- a/src/web/templates/profile.html +++ b/src/web/templates/profile.html @@ -37,6 +37,9 @@ {{ form.is_public_profile.label }} {{ form.is_public_profile(class_="form-control") }} {% for error in form.is_public_profile.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} + + {{ form.webpage.label }} + {{ form.webpage(class_="form-control") }} {% for error in form.webpage.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} <br /> {{ form.submit(class_="btn") }} </form> diff --git a/src/web/templates/profile_public.html b/src/web/templates/profile_public.html index c67a4e91..eac36441 100644 --- a/src/web/templates/profile_public.html +++ b/src/web/templates/profile_public.html @@ -4,8 +4,11 @@ <h1>{{ user.nickname }}</h1> <div class="row"> <div class="col-md-12"> - <p>{{ _('Member since') }} {{ user.date_created | datetime }}.</p> - <p>{{ _('Last seen:') }} {{ user.last_seen | datetime }}.</p> + <p>{{ _('Member since:') }} {{ user.date_created | datetime }}</p> + <p>{{ _('Last seen:') }} {{ user.last_seen | datetime }}</p> + {% if user.webpage %} + <p>{{ _('Webpage:') }} <a href="{{ user.webpage | safe }}">{{ user.webpage | safe }}</a></p> + {% endif %} </div> </div> diff --git a/src/web/views/user.py b/src/web/views/user.py index c7c318e3..df6508f5 100644 --- a/src/web/views/user.py +++ b/src/web/views/user.py @@ -107,7 +107,8 @@ def profile(): 'email': form.email.data, 'password': form.password.data, 'refresh_rate': form.refresh_rate.data, - 'is_public_profile': form.is_public_profile.data}) + 'is_public_profile': form.is_public_profile.data, + 'webpage': form.webpage.data}) flash(gettext('User %(nick)s successfully updated', nick=user.nickname), 'success') |