forked from gergely/calendar-social
Display profiles
This commit is contained in:
@@ -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__)
|
||||
|
Reference in New Issue
Block a user