示例#1
0
文件: views.py 项目: ddunbar/robusta
def current_tasting_my_ratings():
    user = flask.session.get('active_user', None)
    if not user:
        return abort(500)

    item = current_app.get_active_tasting()
    oid = item['_id']

    ratings = []
    for item in current_app.db.ratings.find({ 'tasting' : oid,
                                              'user' : user }):
        ratings.append({ 'products' : item['products'],
                         'rating' : item['rating'],
                         'notes' : item.get('notes','') })

    return flask.jsonify(ratings = ratings)
示例#2
0
文件: views.py 项目: ddunbar/robusta
def current_tasting():
    item = current_app.get_active_tasting()
    if item:
        item["id"] = binascii.hexlify(item.pop('_id').binary)
    return flask.jsonify(tasting = item)