本文整理汇总了Python中issues.models.Issue.get方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.get方法的具体用法?Python Issue.get怎么用?Python Issue.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类issues.models.Issue
的用法示例。
在下文中一共展示了Issue.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: issue_by_number
# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import get [as 别名]
def issue_by_number(pk):
""" Get's the issue by a primary key or a number, i like hacking the url so
you can just put in a number in the URL """
number = safe_int(pk)
if number:
issues = Issue.all().filter("number = ", number)
return issues[0]
else:
return Issue.get(pk)
示例2: edit_project_url
# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import get [as 别名]
def edit_project_url(request, pk):
issue = Issue.get(pk)
urls = IssueProjectURL.all().filter("issue = ", issue)
url_ids = dict([ (url.id, url) for url in urls ])
if request.POST:
for key, value in request.POST.items():
if key in url_ids:
assert value in [ i[0] for i in issue_project_url_statuses ], \
"%s not in %s" % (value, issue_project_url_statuses)
url_ids[key].status = value
url_ids[key].save()
return HttpResponseRedirect(reverse("issues-view", args=[pk,]))
return direct_to_template(request, "issue_project_url.html", extra_context={
"issue": issue,
"urls": urls,
"issue_project_url_statuses": issue_project_url_statuses,
"nav": {"selected": "issues",},
})