def show_graffiti(): if 'current_user_uid' not in session: return redirect(url_for('start')) else: key = str(request.args.get('key')) graffiti = Graffiti.get_by_key(key) return render_template('graffiti.html', graffiti=graffiti, title='YATAM - View Graffiti')
def like_increase_decrease(like_type, key, uid): if Like.check_like_user(key, uid): if like_type == 'RATING': rating = Rating.get_by_key(key) data = { 'nlikes': rating.n_likes - 1 } Rating.update_rating(key, data) elif like_type == 'GRAFFITI': graffiti = Graffiti.get_by_key(key) data = { 'nlikes': graffiti.n_likes - 1 } Graffiti.update_graffiti(key, data) elif like_type == 'USER': leisure = UserLeisure.get_by_key(key) data = { 'nlikes': leisure.n_likes - 1 } UserLeisure.update_user_leisure(key, data) Like.delete_like(key, uid) else: Like.create_like(key, uid) if like_type == 'RATING': rating = Rating.get_by_key(key) data = { 'nlikes': rating.n_likes + 1 } Rating.update_rating(key, data) elif like_type == 'GRAFFITI': graffiti = Graffiti.get_by_key(key) data = { 'nlikes': graffiti.n_likes + 1 } Graffiti.update_graffiti(key, data) elif like_type == 'USER': leisure = UserLeisure.get_by_key(key) data = { 'nlikes': leisure.n_likes + 1 } UserLeisure.update_user_leisure(key, data)