當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。