|
|
@ -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 |
|
|
|
from photoapp.dbutils import SAEnginePlugin, SATool, db, get_db_engine, driver_statement |
|
|
|
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 |
|
|
@ -218,13 +218,16 @@ class DateView(object): |
|
|
|
yield self.master.render("date.html", page=page, pgsize=pgsize, total_sets=total_sets, |
|
|
|
images=[i for i in images], date=dt) |
|
|
|
return |
|
|
|
images = photoset_auth_filter(db.query(PhotoSet, func.strftime('%Y-%m-%d', |
|
|
|
PhotoSet.date).label('gdate'), |
|
|
|
func.count('photos.id'), |
|
|
|
func.strftime('%Y', PhotoSet.date).label('year'), |
|
|
|
func.strftime('%m', PhotoSet.date).label('month'), |
|
|
|
func.strftime('%d', PhotoSet.date).label('day'))). \ |
|
|
|
group_by('gdate').order_by(desc('year'), 'month', 'day').all() |
|
|
|
|
|
|
|
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'), |
|
|
|
date_format('%m', PhotoSet.date).label('month'), |
|
|
|
date_format('%d', PhotoSet.date).label('day'))). \ |
|
|
|
group_by('year', 'month', 'day').order_by(desc('year'), 'month', 'day').all() |
|
|
|
yield self.master.render("dates.html", images=images) |
|
|
|
|
|
|
|
|
|
|
|