Example #1
0
def photos():
    """
    Retrieve uploaded photo information
    :param page: page number for the pagination.
    :return: HTML template for photo list
    """
    results = Photo.query(current_user.id)

    return render_template('home.html', photos=results, gmaps_key=conf['GMAPS_KEY'],
                           sizeof_fmt=util.sizeof_fmt, current_user=current_user, presigned_url=util.presigned_url)
Example #2
0
def search():
    """
    Search function for description and tags in Photo table.
    :return: List of photo object which retrieved DB.
    """
    keyword = request.form['search']
    app.logger.debug(keyword)
    photo_pages = Photo.query(current_user.id, Photo.tags.contains(keyword) | Photo.desc.contains(keyword))

    flash("Search results for '{0}'.. ".format(keyword))
    return render_template('home.html', photos=photo_pages, gmaps_key=conf['GMAPS_KEY'], presigned_url=util.presigned_url)
Example #3
0
def map_view(photo_id=None):
    """
    Map view with photo marker.
    :param photo_id: target photo id
    :return: HTML template for the map.
    """

    if not photo_id:
        photo_list = Photo.query(current_user.id)
        app.logger.debug("photo_id: {0}".format(photo_id))
    else:
        photo_list = Photo.get(current_user.id, photo_id)

    return render_template("map.html", photos=photo_list, gmaps_key=conf['GMAPS_KEY'])
def search():
    """
    Search function for description and tags in Photo table.
    :return: List of photo object which retrieved DB.
    """

    ## TODO #3 : Review following code to search result via keyword in the DynamoDB.
    ## -- begin --
    keyword = request.form['search']
    photo_pages = Photo.query(
        current_user.id,
        Photo.tags.contains(keyword) | Photo.desc.contains(keyword))
    ## -- end --

    flash("Search results for '{0}'.. ".format(keyword))
    return render_template('home.html',
                           photos=photo_pages,
                           gmaps_key=conf['GMAPS_KEY'])
Example #5
0
def photos(page=1):
    """
    Retrieve uploaded photo information
    :param page: page number for the pagination.
    :return: HTML template for photo list
    """

    results = Photo.query(current_user.id)
    photo_count = conf['PER_PAGE'] ## TODO : Paging 관련 DDB Fix 필요
    pagination = Pagination(page, conf['PER_PAGE'], photo_count)

    if page != 1:
        offset = conf['PER_PAGE'] * (page - 1)
    else:
        offset = 0

    return render_template('home.html', pagination=pagination, photos=results, gmaps_key=conf['GMAPS_KEY'],
                           sizeof_fmt=util.sizeof_fmt, current_user=current_user)