예제 #1
0
def location_handler(response, id):
    logged_in = get_login(response)
    context = {}
    user_object = User.find(get_login(response))
    location = Location.find_id(id)
    loc_tags = Tag.find_from_place(location.id)
    if logged_in:
        stars = location.get_user_rating(user_object.id)
        context["user_rating"] = stars
    if location:
        context["location"] = location
        context["loc_tags"] = loc_tags
        context["comments"] = Comment.find_place(location.id)
        render_page("location.html", response, context)
    else:
        error_handler(response)
예제 #2
0
def comment(response, location_id):
    user_object = User.find(get_login(response))
    comment = response.get_field("comment")
    Comment.create(user_object.id, comment, location_id)
    response.redirect("/location/" + location_id)