def index(): path = request.path path = path if path.endswith("/") else "{0}/".format(path) temp = request.app.get("used").get("index") temp = "web".format(temp) if temp.startswith( "/") else "web/{0}".format(temp) # return render_template("web/common/index.html", type="", path=path) print("index渲染模板:", temp) foreign, tableName, template = getForeign(False), getTableName( False), getTemplate(path) isDetail = "detail" in selectTable(False) return render(temp, type="", path=path, foreign=foreign, tableName=tableName, template=template, isDetail=isDetail)
def index_detail(): path = request.path path = path if path.endswith("/") else "{0}/".format(path) params = Requester(request) id, name = params.value("id"), params.value("name") temp = request.app.get("used").get("detail") temp = "web".format(temp) if temp.startswith( "/") else "web/{0}".format(temp) print("detail渲染模板:", temp) foreign, tableName, relatedName = getForeign(True), getTableName( True), getTableName(False) template, isDetail = getTemplate(path), "deep" in selectTable( False).get("detail", {}) return render(temp, type="", path=path, related=id, detail="{0}-详情:".format(name), foreign=foreign, tableName=tableName, relatedName=relatedName, template=template, isDetail=isDetail)
def getForeign(isDetail=False): return selectTable(isDetail).get("foreign", [])
def getDetailName(): return selectTable(False).get("detail", {}).get("name")
def getTableName(isDetail=False): return selectTable(isDetail).get("name")