mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
I with push my head through a conrete wall
I hate Joins
This commit is contained in:
parent
0a27d79a82
commit
91278e2d11
10 changed files with 180 additions and 187 deletions
|
@ -22,7 +22,10 @@ def index():
|
|||
"""
|
||||
Home page of the website, shows the feed of latest images
|
||||
"""
|
||||
images = db_session.query(db.Posts.file_name, db.Posts.id, db.Posts.created_at).order_by(db.Posts.id.desc()).all()
|
||||
images = db_session.query(db.Posts.file_name,
|
||||
db.Posts.id,
|
||||
db.Posts.created_at
|
||||
).order_by(db.Posts.id.desc()).all()
|
||||
|
||||
return render_template('index.html',
|
||||
images=images,
|
||||
|
@ -35,10 +38,12 @@ def image(image_id):
|
|||
"""
|
||||
Image view, shows the image and its metadata
|
||||
"""
|
||||
img = db_session.query(db.Posts).filter_by(id=image_id).first()
|
||||
|
||||
img = db_session.query(db.Posts).filter(db.Posts.id == image_id).first()
|
||||
author = db_session.query(db.Users.username).filter(db.Users.id == img.author_id).first()[0]
|
||||
img.author_username = author
|
||||
|
||||
if img is None:
|
||||
abort(404)
|
||||
abort(404, 'Image not found')
|
||||
|
||||
return render_template('image.html', image=img, exif=img.image_exif)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue