mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Submitted to PyLints needs :3
This commit is contained in:
parent
4cfcd178f1
commit
7ed3b455dd
12 changed files with 509 additions and 460 deletions
|
@ -1,23 +1,27 @@
|
|||
from flask import Blueprint, render_template, current_app
|
||||
from werkzeug.exceptions import abort
|
||||
from werkzeug.utils import secure_filename
|
||||
|
||||
from gallery.auth import login_required
|
||||
|
||||
from . import db
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
db_session = sessionmaker(bind=db.engine)
|
||||
db_session = db_session()
|
||||
|
||||
from . import metadata as mt
|
||||
|
||||
"""
|
||||
Onlylegs Gallery - Routing
|
||||
"""
|
||||
import os
|
||||
|
||||
from flask import Blueprint, render_template, current_app
|
||||
from werkzeug.exceptions import abort
|
||||
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from . import db
|
||||
from . import metadata as mt
|
||||
|
||||
|
||||
blueprint = Blueprint('gallery', __name__)
|
||||
db_session = sessionmaker(bind=db.engine)
|
||||
db_session = db_session()
|
||||
|
||||
|
||||
@blueprint.route('/')
|
||||
def index():
|
||||
"""
|
||||
Home page of the website, shows the feed of latest images
|
||||
"""
|
||||
images = db_session.query(db.posts).order_by(db.posts.id.desc()).all()
|
||||
|
||||
return render_template('index.html',
|
||||
|
@ -26,10 +30,12 @@ def index():
|
|||
name=current_app.config['WEBSITE']['name'],
|
||||
motto=current_app.config['WEBSITE']['motto'])
|
||||
|
||||
|
||||
@blueprint.route('/image/<int:id>')
|
||||
def image(id):
|
||||
img = db_session.query(db.posts).filter_by(id=id).first()
|
||||
@blueprint.route('/image/<int:image_id>')
|
||||
def image(image_id):
|
||||
"""
|
||||
Image view, shows the image and its metadata
|
||||
"""
|
||||
img = db_session.query(db.posts).filter_by(id=image_id).first()
|
||||
|
||||
if img is None:
|
||||
abort(404)
|
||||
|
@ -39,28 +45,30 @@ def image(id):
|
|||
|
||||
return render_template('image.html', image=img, exif=exif)
|
||||
|
||||
|
||||
@blueprint.route('/group')
|
||||
def groups():
|
||||
"""
|
||||
Group overview, shows all image groups
|
||||
"""
|
||||
return render_template('group.html', group_id='gwa gwa')
|
||||
|
||||
|
||||
@blueprint.route('/group/<int:id>')
|
||||
def group(id):
|
||||
return render_template('group.html', group_id=id)
|
||||
|
||||
|
||||
@blueprint.route('/upload')
|
||||
@login_required
|
||||
def upload():
|
||||
return render_template('upload.html')
|
||||
|
||||
@blueprint.route('/group/<int:group_id>')
|
||||
def group(group_id):
|
||||
"""
|
||||
Group view, shows all images in a group
|
||||
"""
|
||||
return render_template('group.html', group_id=group_id)
|
||||
|
||||
@blueprint.route('/profile')
|
||||
def profile():
|
||||
"""
|
||||
Profile overview, shows all profiles on the onlylegs gallery
|
||||
"""
|
||||
return render_template('profile.html', user_id='gwa gwa')
|
||||
|
||||
|
||||
@blueprint.route('/profile/<int:id>')
|
||||
def profile_id(id):
|
||||
return render_template('profile.html', user_id=id)
|
||||
@blueprint.route('/profile/<int:user_id>')
|
||||
def profile_id(user_id):
|
||||
"""
|
||||
Shows user ofa given id, displays their uploads and other info
|
||||
"""
|
||||
return render_template('profile.html', user_id=user_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue