예제 #1
0
파일: category_logic.py 프로젝트: niczy/hyo
def add(restaurant, category_name): 
  if isinstance(restaurant, str) or isinstance(restaurant, unicode):
    restaurant = ndb.Key(Restaurant, restaurant)
  check_get_restaurant(restaurant)
  category = Category(restaurant_key = restaurant, name = category_name)
  return category.put().get()
예제 #2
0
파일: dish_logic.py 프로젝트: niczy/hyo
def get_all_by_restaurant_uid(restaurant_uid):
  restaurant_key = ndb.Key(Restaurant, restaurant_uid)
  check_get_restaurant(restaurant_key)
  return Dish.query(Dish.restaurant_key == restaurant_key).fetch()
예제 #3
0
파일: category_logic.py 프로젝트: niczy/hyo
def get_all_by_restaurant_key(restaurant_key):
  check_get_restaurant(restaurant_key)
  return Category.query(Category.restaurant_key == restaurant_key).fetch()
예제 #4
0
def delete(uid):
    restaurant_key = ndb.Key(Restaurant, uid)
    check_get_restaurant(restaurant_key)
    restaurant_key.delete()