Ejemplo n.º 1
0
def browse():
    start = time.time()
    filterType = utils.intOrNone(request.args.get('type', None))
    filterMedium = utils.intOrNone(request.args.get('medium', None))
    mediums = Medium.all()
    styles = Style.all()
    types = Type.all()
    supports = Support.all()
    baseQuery = Artwork.reviewedArt().order_by(Artwork.created_on)
    if filterType:
        baseQuery = baseQuery.filter(Artwork.type == filterType)
    if filterMedium:
        baseQuery = baseQuery.filter(Artwork.medium == filterMedium)

    artwork = baseQuery.all()
    app.logger.debug('Queries took: %fs' % (time.time() - start))
    return render_template('browse.html',
                           artwork=artwork,
                           numArts=len(artwork),
                           mediums=mediums,
                           styles=styles,
                           types=types,
                           supports=supports,
                           filterType=filterType,
                           filterMedium=filterMedium)
Ejemplo n.º 2
0
def browse():
    start = time.time()
    filterType = utils.intOrNone(request.args.get('type',None))
    filterMedium = utils.intOrNone(request.args.get('medium',None))
    mediums = Medium.all()
    styles = Style.all()
    types = Type.all()
    supports = Support.all()
    baseQuery = Artwork.reviewedArt().order_by(Artwork.created_on)
    if filterType:
        baseQuery = baseQuery.filter(Artwork.type == filterType)
    if filterMedium:
        baseQuery = baseQuery.filter(Artwork.medium == filterMedium)
    
    artwork = baseQuery.all()
    app.logger.debug('Queries took: %fs' % (time.time() - start) )
    return render_template('browse.html', artwork=artwork, numArts = len(artwork), mediums=mediums,styles=styles,types=types,supports=supports, filterType=filterType, filterMedium=filterMedium)
Ejemplo n.º 3
0
def _browse():
    type = request.args.get('type', -1, type=int)
    medium = request.args.get('medium', -1, type=int)
    art = Artwork.reviewedArt().all()
    return jsonify(arts=[a.json() for a in art])
Ejemplo n.º 4
0
def home():
    artwork = Artwork.reviewedArt().order_by(
        Artwork.created_on).limit(10).all()
    return render_template('home.html', recentArtwork=artwork)
Ejemplo n.º 5
0
def _browse():
    type = request.args.get('type', -1, type=int)
    medium = request.args.get('medium', -1, type=int)
    art = Artwork.reviewedArt().all()
    return jsonify(arts=[a.json() for a in art])
Ejemplo n.º 6
0
def home():
    artwork = Artwork.reviewedArt().order_by(Artwork.created_on).limit(10).all()
    return render_template('home.html', recentArtwork = artwork)