forked from gergely/calendar-social
Make User.profile a single object instead of a list
Because it’s a one-to-one relationship anyway, what’s the use of lists here?
This commit is contained in:
@@ -256,12 +256,10 @@ class CalendarSocialApp(Flask):
|
||||
|
||||
from .models import Profile, User
|
||||
|
||||
try:
|
||||
profile = Profile.query.join(User).filter(User.username == username.lower()).one()
|
||||
except NoResultFound:
|
||||
profile = current_user.profile
|
||||
|
||||
if profile is None:
|
||||
abort(404)
|
||||
except MultipleResultsFound:
|
||||
abort(500)
|
||||
|
||||
return render_template('profile-details.html', profile=profile)
|
||||
|
||||
|
Reference in New Issue
Block a user