def unpublished(): base_query = (Postcard.query.filter(Postcard.deleted == False) .filter(db.or_(Postcard.published == False, Postcard.published == None)) .options(db.subqueryload('tags')) .order_by(db.asc(Postcard.date))) pagination = build_pagination(base_query) # patch in larger thumbnails for postcard in pagination.items: info = {} jsoninfo = getattr(postcard, 'json_image_info') if jsoninfo: info = json.loads(jsoninfo).get('small', {}) postcard.front_thumb = info.get('front', {}) postcard.back_thumb = info.get('back', {}) return render_template( 'unpublished.html', url_base='//s3.amazonaws.com/' + app.config['S3_BUCKET'] + '/', DEFAULT_THUMB='noimage-large.png', DEFAULT_THUMB_WIDTH=215, DEFAULT_THUMB_HEIGHT=215, pagination=pagination, current_page=".unpublished", )
def unpublished(): base_query = (Postcard.query.filter(Postcard.deleted == False).filter( db.or_(Postcard.published == False, Postcard.published == None)).options( db.subqueryload('tags')).order_by(db.asc(Postcard.date))) pagination = build_pagination(base_query) # patch in larger thumbnails for postcard in pagination.items: info = {} jsoninfo = getattr(postcard, 'json_image_info') if jsoninfo: info = json.loads(jsoninfo).get('small', {}) postcard.front_thumb = info.get('front', {}) postcard.back_thumb = info.get('back', {}) return render_template( 'unpublished.html', url_base='//s3.amazonaws.com/' + app.config['S3_BUCKET'] + '/', DEFAULT_THUMB='noimage-large.png', DEFAULT_THUMB_WIDTH=215, DEFAULT_THUMB_HEIGHT=215, pagination=pagination, current_page=".unpublished", )
def home(): base_query = (Postcard.query.filter(Postcard.deleted == False) .options(db.subqueryload('tags')) .order_by(db.desc(Postcard.date))) search_query = request.args.get('q') if search_query: base_query = base_query.filter(Postcard.user.like("%" + search_query + "%")) pagination = build_pagination(base_query) return render_template( 'home.html', url_base='//s3.amazonaws.com/' + app.config['S3_BUCKET'] + '/', DEFAULT_THUMB='noimage.png', pagination=pagination, search_query=search_query, current_page=".home", )
def home(): base_query = (Postcard.query.filter(Postcard.deleted == False).options( db.subqueryload('tags')).order_by(db.desc(Postcard.date))) search_query = request.args.get('q') if search_query: base_query = base_query.filter( Postcard.user.like("%" + search_query + "%")) pagination = build_pagination(base_query) return render_template( 'home.html', url_base='//s3.amazonaws.com/' + app.config['S3_BUCKET'] + '/', DEFAULT_THUMB='noimage.png', pagination=pagination, search_query=search_query, current_page=".home", )
def home(): base_query = (Postcard.query.filter(Postcard.deleted == False).options( db.subqueryload('tags')).order_by(db.desc(Postcard.date))) search_query = request.args.get('q') if search_query: base_query = base_query.filter( Postcard.user.like("%" + search_query + "%")) page_number = int(request.args.get('page', 1)) page_size = int(request.args.get('count', 25)) pagination = base_query.paginate(page_number, per_page=page_size) return render_template( 'home.html', postcards=pagination.items, url_base='http://' + app.config['S3_BUCKET'] + '.s3.amazonaws.com/', DEFAULT_THUMB='noimage.png', pagination=pagination, search_query=search_query, )
def home(): base_query = (Postcard.query.filter(Postcard.deleted == False) .options(db.subqueryload('tags')) .order_by(db.desc(Postcard.date))) search_query = request.args.get('q') if search_query: base_query = base_query.filter(Postcard.user.like("%" + search_query + "%")) page_number = int(request.args.get('page', 1)) page_size = int(request.args.get('count', 25)) pagination = base_query.paginate(page_number, per_page=page_size) return render_template( 'home.html', postcards=pagination.items, url_base='http://' + app.config['S3_BUCKET'] + '.s3.amazonaws.com/', DEFAULT_THUMB='noimage.png', pagination=pagination, search_query=search_query, )