123456789101112 |
- def display(foods):
- """传递过来的结果集"""
- display_list = []
- childrens = []
- for food in foods:
- display_list.append({'id':food.id,'authName':food.authName,'path':food.path,'icon':food.icon,'partment_id':food.partment_id,'childrens':childrens})
- children = food.children.all()
- if len(children) > 0:
- # print(children,str(itm))
- childrens.append(display(food.children.all()))
- childrens = []
- return display_list
|