当前位置: 首页>>代码示例>>Python>>正文


Python Issue.get方法代码示例

本文整理汇总了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)
开发者ID:alanjds,项目名称:arecibo,代码行数:11,代码来源:views.py

示例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",},
    })
开发者ID:alanjds,项目名称:arecibo,代码行数:20,代码来源:views.py


注:本文中的issues.models.Issue.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。