本文整理汇总了Python中model.Link.get_link_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Link.get_link_by_id方法的具体用法?Python Link.get_link_by_id怎么用?Python Link.get_link_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Link
的用法示例。
在下文中一共展示了Link.get_link_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from model import Link [as 别名]
# 或者: from model.Link import get_link_by_id [as 别名]
def get(self):
act = self.get_argument("act",'')
id = self.get_argument("id",'')
obj = None
if act == 'del':
if id:
Link.del_link_by_id(id)
clear_cache_by_pathlist(['/'])
self.redirect('%s/admin/links'% (BASE_URL))
return
elif act == 'edit':
if id:
obj = Link.get_link_by_id(id)
clear_cache_by_pathlist(['/'])
self.echo('admin_link.html', {
'title': "管理友情链接",
'objs': Link.get_all_links(),
'obj': obj,
},layout='_layout_admin.html')
示例2: get
# 需要导入模块: from model import Link [as 别名]
# 或者: from model.Link import get_link_by_id [as 别名]
def get(self):
act = self.get_argument("act", "")
id = self.get_argument("id", "")
obj = None
if act == "del":
if id:
Link.del_link_by_id(id)
clear_cache_by_pathlist(["/"])
self.redirect("%s/admin/links" % (BASE_URL))
return
elif act == "edit":
if id:
obj = Link.get_link_by_id(id)
clear_cache_by_pathlist(["/"])
self.echo(
"admin_link.html",
{"title": "管理友情链接", "objs": Link.get_all_links(), "obj": obj},
layout="_layout_admin.html",
)