Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lubianat committed May 2, 2023
1 parent 93472b9 commit 13720b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
Binary file modified app/app.db
Binary file not shown.
3 changes: 3 additions & 0 deletions app/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length
from app.models import User

from wtforms import StringField, TextAreaField, SubmitField
from wtforms.validators import DataRequired, Length


class EditProfileForm(FlaskForm):
username = StringField("Username", validators=[DataRequired()])
Expand Down
3 changes: 2 additions & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from werkzeug.urls import url_parse

from datetime import datetime
from app.forms import EditProfileForm


@app.before_request
Expand All @@ -19,7 +20,7 @@ def before_request():
@app.route("/edit_profile", methods=["GET", "POST"])
@login_required
def edit_profile():
form = EditProfileForm(current_user.username)
form = EditProfileForm()
if form.validate_on_submit():
current_user.username = form.username.data
current_user.about_me = form.about_me.data
Expand Down
5 changes: 5 additions & 0 deletions app/templates/user.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
<h1>User: {{ user.username }}</h1>
{% if user.about_me %}<p>{{ user.about_me }}</p>{% endif %}
{% if user.last_seen %}<p>Last seen on: {{ user.last_seen }}</p>{% endif %}
{% if user == current_user %}
<p><a href="{{ url_for('edit_profile') }}">Edit your profile</a></p>
{% endif %}
</td>

</tr>

<hr>
{% for post in posts %}
{% include "_post.html" %}
Expand Down

0 comments on commit 13720b2

Please sign in to comment.