当前位置: 首页>>代码示例>>Python>>正文


Python Category.getDataNames方法代码示例

本文整理汇总了Python中models.Category.getDataNames方法的典型用法代码示例。如果您正苦于以下问题:Python Category.getDataNames方法的具体用法?Python Category.getDataNames怎么用?Python Category.getDataNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Category的用法示例。


在下文中一共展示了Category.getDataNames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render_search

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
def render_search():
    create_whoosh_dir()
    rest_ix = get_restaurant_index()
    loc_ix = get_location_index()
    cat_ix = get_category_index()

    restSearchableFields = ["name","phonenum"]
    locSearchableFields = ["address","neighborhood", "zipcode"]
    catSearchableFields = ["name"]

    restDataList = []
    locDataList = []
    catDataList = []

    if request.method == 'POST':
        search_query = request.form['search']
        restDataList = search_results(rest_ix, search_query, restSearchableFields)
        locDataList = search_results(loc_ix, search_query, locSearchableFields)
        catDataList = search_results(cat_ix, search_query, catSearchableFields)
        constructRelatedModels(restDataList, locDataList, catDataList)

    return render_template('search_results.html',
        restDataNames=Restaurant.getDataNames() + ["context"],
        restDataList=restDataList,
        locDataNames=Location.getDataNames() + ["context"],
        locDataList=locDataList,
        catDataNames=Category.getDataNames() + ["context"],
        catDataList=catDataList)
开发者ID:brockuniera,项目名称:cs373-idb,代码行数:30,代码来源:app.py

示例2: render_location_id

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
def render_location_id(location_id=None):
    locModel = Location.query.get_or_404(location_id)
    relatedRestModel = Restaurant.query.filter_by(location_id = location_id).one()
    catListModels = getDataDictList(relatedRestModel.catlist)
    return render_template('location.html',
        locModel = locModel,
        restModel = relatedRestModel,
        catAttrs = Category.getDataNames(),
        catListModels = dumps(catListModels))
开发者ID:brockuniera,项目名称:cs373-idb,代码行数:11,代码来源:app.py

示例3: render_category

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
def render_category():
    tableDataDict = getTableDataDict("Categories","category", Category)
    catDataDictList = getDataDictList(getModels(Category, tableDataDict['offset'],
        tableDataDict['sortby'], tableDataDict['direction']))
    return render_template('template_db.html',
            dataNames=Category.getDataNames(),
            dataList=catDataDictList,
            **tableDataDict
        )
开发者ID:brockuniera,项目名称:cs373-idb,代码行数:11,代码来源:app.py

示例4: render_restaurant_id

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
def render_restaurant_id(restaurant_id=None):
    restModel = Restaurant.query.get_or_404(restaurant_id)
    relatedLocModel = Location.query.get(restModel.location_id)
    catListModels = getDataDictList(restModel.catlist)
    return render_template('restaurant.html',
        restModel = restModel,
        locModel = relatedLocModel,
        catAttrs = Category.getDataNames(),
        catListModels = dumps(catListModels))
开发者ID:brockuniera,项目名称:cs373-idb,代码行数:11,代码来源:app.py

示例5: test_get_data_names_2

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
 def test_get_data_names_2(self):
     self.assertEqual(Category.getDataNames()[0], "id")
开发者ID:ZachSand,项目名称:cs373-idb,代码行数:4,代码来源:tests.py

示例6: test_get_data_names_1

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
 def test_get_data_names_1(self):
     self.assertEqual(Category.getDataNames(), ["id", "name", "resttotal", "reviewtotal", "ratingavg"])
开发者ID:ZachSand,项目名称:cs373-idb,代码行数:4,代码来源:tests.py

示例7: test_get_data_names_0

# 需要导入模块: from models import Category [as 别名]
# 或者: from models.Category import getDataNames [as 别名]
 def test_get_data_names_0(self):
     self.assertEqual(len(Category.getDataNames()), 5)
开发者ID:ZachSand,项目名称:cs373-idb,代码行数:4,代码来源:tests.py


注:本文中的models.Category.getDataNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。