示例#1
0
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
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()