users: allow norm-equivalent names in profile url

This commit is contained in:
Lephe 2019-09-09 08:02:36 +02:00
parent 8a0ba309e0
commit 79e5af7924
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 3 additions and 1 deletions

View File

@ -1,12 +1,14 @@
from flask import redirect, url_for
from app import app
from app.models.users import Member
from app.utils import unicode_names
from app.utils.render import render
@app.route('/user/<username>')
def user(username):
member = Member.query.filter_by(name=username).first_or_404()
norm = unicode_names.normalize(username)
member = Member.query.filter_by(norm=norm).first_or_404()
return render('user.html', member=member)