|
|
|
@ -9,7 +9,7 @@ from photoapp.types import Photo, PhotoSet, Tag, TagItem, PhotoStatus, User
|
|
|
|
|
from photoapp.dbsession import DatabaseSession
|
|
|
|
|
from photoapp.common import pwhash
|
|
|
|
|
from photoapp.api import PhotosApi, LibraryManager
|
|
|
|
|
from photoapp.dbutils import SAEnginePlugin, SATool, db, get_db_engine, driver_statement
|
|
|
|
|
from photoapp.dbutils import SAEnginePlugin, SATool, db, get_db_engine, date_format
|
|
|
|
|
from photoapp.utils import mime2ext, auth, require_auth, photoset_auth_filter, slugify
|
|
|
|
|
from photoapp.storage import uri_to_storage
|
|
|
|
|
from jinja2 import Environment, FileSystemLoader, select_autoescape
|
|
|
|
@ -97,8 +97,8 @@ class PhotosWeb(object):
|
|
|
|
|
/stats - show server statistics
|
|
|
|
|
"""
|
|
|
|
|
images = photoset_auth_filter(db.query(func.count(PhotoSet.uuid),
|
|
|
|
|
func.strftime('%Y', PhotoSet.date).label('year'),
|
|
|
|
|
func.strftime('%m', PhotoSet.date).label('month'))). \
|
|
|
|
|
date_format('%Y', PhotoSet.date).label('year'),
|
|
|
|
|
date_format('%m', PhotoSet.date).label('month'))). \
|
|
|
|
|
group_by('year', 'month').order_by(desc('year'), desc('month')).all()
|
|
|
|
|
tsize = photoset_auth_filter(db.query(func.sum(Photo.size)).join(PhotoSet)).scalar() # pragma: manual auth
|
|
|
|
|
yield self.render("monthly.html", images=images, tsize=tsize)
|
|
|
|
@ -219,9 +219,6 @@ class DateView(object):
|
|
|
|
|
images=[i for i in images], date=dt)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
date_format = driver_statement({"sqlite": lambda date_format, value: func.strftime(date_format, value),
|
|
|
|
|
"mysql": lambda date_format, value: func.date_format(value, date_format)})
|
|
|
|
|
|
|
|
|
|
images = photoset_auth_filter(db.query(
|
|
|
|
|
func.count(PhotoSet.id),
|
|
|
|
|
date_format('%Y', PhotoSet.date).label('year'),
|
|
|
|
|