mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 03:26:16 +00:00
Format code with Black
This commit is contained in:
parent
fef8a557d2
commit
128464d43f
18 changed files with 697 additions and 604 deletions
|
@ -9,31 +9,31 @@ from sqlalchemy.orm import sessionmaker
|
|||
from gallery import db
|
||||
|
||||
|
||||
blueprint = Blueprint('profile', __name__, url_prefix='/profile')
|
||||
blueprint = Blueprint("profile", __name__, url_prefix="/profile")
|
||||
db_session = sessionmaker(bind=db.engine)
|
||||
db_session = db_session()
|
||||
|
||||
|
||||
@blueprint.route('/profile')
|
||||
@blueprint.route("/profile")
|
||||
def profile():
|
||||
"""
|
||||
Profile overview, shows all profiles on the onlylegs gallery
|
||||
"""
|
||||
user_id = request.args.get('id', default=None, type=int)
|
||||
user_id = request.args.get("id", default=None, type=int)
|
||||
|
||||
# If there is no userID set, check if the user is logged in and display their profile
|
||||
if not user_id:
|
||||
if current_user.is_authenticated:
|
||||
user_id = current_user.id
|
||||
else:
|
||||
abort(404, 'You must be logged in to view your own profile!')
|
||||
abort(404, "You must be logged in to view your own profile!")
|
||||
|
||||
# Get the user's data
|
||||
user = db_session.query(db.Users).filter(db.Users.id == user_id).first()
|
||||
|
||||
if not user:
|
||||
abort(404, 'User not found :c')
|
||||
abort(404, "User not found :c")
|
||||
|
||||
images = db_session.query(db.Posts).filter(db.Posts.author_id == user_id).all()
|
||||
|
||||
return render_template('profile.html', user=user, images=images)
|
||||
return render_template("profile.html", user=user, images=images)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue