本文整理汇总了Python中models.team.Team.get方法的典型用法代码示例。如果您正苦于以下问题:Python Team.get方法的具体用法?Python Team.get怎么用?Python Team.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.team.Team
的用法示例。
在下文中一共展示了Team.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_tag
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import get [as 别名]
def delete_tag(request):
# FIXME: ugly
if request.method == "POST":
user = request.user
if not user:
return {'r': 0, 'msg': '未登录,请先登录'}
tag_name = request.get_form_var('tag_name', '').decode('utf-8')
tag_type = request.get_form_var('tag_type', '')
tag_target_id = request.get_form_var('tag_target_id', '')
if not tag_name:
return {'r': 0, 'msg': 'tag不能为空'}
try:
tag_type, tag_target_id = int(tag_type), int(tag_target_id)
except:
return {'r': 0, 'msg': '错误的数据类型'}
if tag_type == TAG_TYPE_PROJECT_ISSUE:
target = CodeDoubanProject.get(tag_target_id)
elif tag_type == TAG_TYPE_TEAM_ISSUE:
target = Team.get(tag_target_id)
else:
return {'r': 0, 'msg': '错误的数据类型'}
if not target.is_admin(user.name):
return {'r': 0, 'msg': '没有操作权限'}
tname = TagName.get_by_name_and_target_id(tag_name, tag_type, target.id)
if not tname:
return {'r': 0, 'msg': 'tag不存在'}
tags = Tag.gets_by_tag_id(tname.id)
for tag in tags:
tag.delete()
tname.delete()
return {'r': 1, 'msg': '删除成功'}
示例2: target
# 需要导入模块: from models.team import Team [as 别名]
# 或者: from models.team.Team import get [as 别名]
def target(self):
from models.team import Team
return Team.get(self.team_id)