Display profiles

This commit is contained in:
2018-07-09 09:57:23 +02:00
parent 2136546390
commit ad53608966
3 changed files with 29 additions and 1 deletions

View File

@@ -245,5 +245,25 @@ class CalendarSocialApp(Flask):
return render_template('event-details.html', event=event)
@staticmethod
@route('/profile/@<string:username>')
def display_profile(username):
"""View to display profile details
"""
from flask import abort
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from .models import Profile, User
try:
profile = Profile.query.join(User).filter(User.username == username.lower()).one()
except NoResultFound:
abort(404)
except MultipleResultsFound:
abort(500)
return render_template('profile-details.html', profile=profile)
app = CalendarSocialApp(__name__)