diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-10-06 11:09:21 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-10-06 11:09:21 +0200 |
commit | c8122e1981527a716639561cc3f880764f06387b (patch) | |
tree | 56c58229ba294f89870b027dc18585cc19d2dc54 /src | |
parent | Improved layout of the profile page. (diff) | |
download | newspipe-c8122e1981527a716639561cc3f880764f06387b.tar.gz newspipe-c8122e1981527a716639561cc3f880764f06387b.tar.bz2 newspipe-c8122e1981527a716639561cc3f880764f06387b.zip |
The user can now add its twitter page.
Diffstat (limited to 'src')
-rw-r--r-- | src/web/forms.py | 1 | ||||
-rw-r--r-- | src/web/models/user.py | 1 | ||||
-rw-r--r-- | src/web/templates/profile.html | 3 | ||||
-rw-r--r-- | src/web/templates/profile_public.html | 3 | ||||
-rw-r--r-- | src/web/views/user.py | 3 |
5 files changed, 10 insertions, 1 deletions
diff --git a/src/web/forms.py b/src/web/forms.py index f651c189..69abac46 100644 --- a/src/web/forms.py +++ b/src/web/forms.py @@ -157,6 +157,7 @@ class ProfileForm(Form): password = PasswordField(lazy_gettext("Password")) password_conf = PasswordField(lazy_gettext("Password Confirmation")) webpage = URLField(lazy_gettext("Webpage")) + twitter = URLField(lazy_gettext("Twitter")) is_public_profile = BooleanField(lazy_gettext("Public profile"), default=True) submit = SubmitField(lazy_gettext("Save")) diff --git a/src/web/models/user.py b/src/web/models/user.py index c8ed33f8..59c4ad38 100644 --- a/src/web/models/user.py +++ b/src/web/models/user.py @@ -50,6 +50,7 @@ class User(db.Model, UserMixin, RightMixin): is_public_profile = db.Column(db.Boolean(), default=False) webpage = db.Column(db.String(), default="") + twitter = db.Column(db.String(), default="") date_created = db.Column(db.DateTime(), default=datetime.utcnow) last_seen = db.Column(db.DateTime(), default=datetime.utcnow) diff --git a/src/web/templates/profile.html b/src/web/templates/profile.html index a8eac38f..d21608cf 100644 --- a/src/web/templates/profile.html +++ b/src/web/templates/profile.html @@ -36,6 +36,9 @@ {{ form.webpage.label }} {{ form.webpage(class_="form-control") }} {% for error in form.webpage.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} + {{ form.twitter.label }} + {{ form.twitter(class_="form-control") }} {% for error in form.twitter.errors %} <span style="color: red;">{{ error }}<br /></span>{% endfor %} + {{ 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 %} <p>{{ _('Your profile will be available <a href="%(url)s">here</a>.', url=url_for('user.profile_public', nickname=user.nickname) ) }}</p> diff --git a/src/web/templates/profile_public.html b/src/web/templates/profile_public.html index ea13ae63..aed5bfcc 100644 --- a/src/web/templates/profile_public.html +++ b/src/web/templates/profile_public.html @@ -9,6 +9,9 @@ {% if user.webpage %} <p>{{ _('Webpage') }}: <a href="{{ user.webpage | safe }}">{{ user.webpage | safe }}</a></p> {% endif %} + {% if user.twitter %} + <p>{{ _('Twitter') }}: <a href="{{ user.twitter | safe }}">{{ user.twitter | safe }}</a></p> + {% endif %} </div> </div> diff --git a/src/web/views/user.py b/src/web/views/user.py index b877f9c7..bf568d69 100644 --- a/src/web/views/user.py +++ b/src/web/views/user.py @@ -108,7 +108,8 @@ def profile(): 'email': form.email.data, 'password': form.password.data, 'is_public_profile': form.is_public_profile.data, - 'webpage': form.webpage.data}) + 'webpage': form.webpage.data, + 'twitter': form.twitter.data}) flash(gettext('User %(nick)s successfully updated', nick=user.nickname), 'success') |