long username titles
This commit is contained in:
parent
bcec5d05c8
commit
619ce9b0bd
@ -111,6 +111,7 @@ def reset_password(token):
|
|||||||
@login_required
|
@login_required
|
||||||
def user(username):
|
def user(username):
|
||||||
user = db.first_or_404(sa.select(User).where(User.username == username))
|
user = db.first_or_404(sa.select(User).where(User.username == username))
|
||||||
|
shortname = (current_user.username[:10] + '...') if len(current_user.username) > 14 else current_user.username
|
||||||
page = request.args.get('page', 1, type=int)
|
page = request.args.get('page', 1, type=int)
|
||||||
query = user.posts.select().order_by(Post.timestamp.desc())
|
query = user.posts.select().order_by(Post.timestamp.desc())
|
||||||
posts = db.paginate(query, page=page, per_page=app.config['POSTS_PER_PAGE'], error_out=False)
|
posts = db.paginate(query, page=page, per_page=app.config['POSTS_PER_PAGE'], error_out=False)
|
||||||
@ -118,12 +119,13 @@ def user(username):
|
|||||||
prev_url = url_for('user', username=user.username, page=posts.prev_num) if posts.has_prev else None
|
prev_url = url_for('user', username=user.username, page=posts.prev_num) if posts.has_prev else None
|
||||||
|
|
||||||
form = EmptyForm()
|
form = EmptyForm()
|
||||||
return render_template('user.html', title='oily profile', user=user, posts=posts.items, next_url=next_url, prev_url=prev_url, form=form)
|
return render_template('user.html', title='oily profile - '+shortname, user=user, posts=posts.items, next_url=next_url, prev_url=prev_url, form=form)
|
||||||
|
|
||||||
@app.route('/edit_profile', methods=['GET', 'POST'])
|
@app.route('/edit_profile', methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def edit_profile():
|
def edit_profile():
|
||||||
form = EditProfileForm(current_user.username)
|
form = EditProfileForm(current_user.username)
|
||||||
|
shortname = (current_user.username[:10] + '...') if len(current_user.username) > 14 else current_user.username
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
current_user.username = form.username.data
|
current_user.username = form.username.data
|
||||||
current_user.about_me = form.about_me.data
|
current_user.about_me = form.about_me.data
|
||||||
@ -133,7 +135,7 @@ def edit_profile():
|
|||||||
elif request.method == 'GET':
|
elif request.method == 'GET':
|
||||||
form.username.data = current_user.username
|
form.username.data = current_user.username
|
||||||
form.about_me.data = current_user.about_me
|
form.about_me.data = current_user.about_me
|
||||||
return render_template('edit_profile.html', title='oily edit profile', form=form)
|
return render_template('edit_profile.html', title='oily edit profile - '+shortname, form=form)
|
||||||
|
|
||||||
@app.route('/follow/<username>', methods=['POST'])
|
@app.route('/follow/<username>', methods=['POST'])
|
||||||
@login_required
|
@login_required
|
||||||
|
Loading…
Reference in New Issue
Block a user