X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/b937806fb5039b4073784b576ffeb30c7fab499c..fe7afb91d071aaf21034561840588e82425f3d8a:/floof/controllers/users.py diff --git a/floof/controllers/users.py b/floof/controllers/users.py index 1e251f0..7c24c0f 100644 --- a/floof/controllers/users.py +++ b/floof/controllers/users.py @@ -2,11 +2,10 @@ import logging from pylons import request, response, session, tmpl_context as c from pylons.controllers.util import abort, redirect_to -from sqlalchemy import func from sqlalchemy.orm.exc import NoResultFound from floof.lib.base import BaseController, render -from floof.model.users import User +from floof.model.users import User, UserRelationship log = logging.getLogger(__name__) @@ -24,9 +23,15 @@ class UsersController(BaseController): """Userpage.""" try: - c.this_user = User.query.filter(func.lower(User.name) == name) \ - .one() + c.this_user = User.get_by(name=name) except NoResultFound: abort(404) + rels = UserRelationship.query.filter_by( + user_id=c.user.id, + target_user_id=c.this_user.id, + ).all() + + c.relationships = [_.type for _ in rels] + return render('/users/view.mako')