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


Python Issue.objects方法代码示例

本文整理汇总了Python中issues.models.Issue.objects方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.objects方法的具体用法?Python Issue.objects怎么用?Python Issue.objects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在issues.models.Issue的用法示例。


在下文中一共展示了Issue.objects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import objects [as 别名]
 def delete(self, *args, **kwargs):
     """docstring for delete"""
     from issues.models import Issue
     from resources.models import Resource, Curation
     res = Resource.objects(owner=self)
     curs = Curation.objects(owner=self)
     if curs.count() or res.count():
         raise Exception('This account owns resources/curations.')
     Collection.objects(owner=self).delete()
     Issue.objects(reporter=self).delete()
     User.objects.get(pk=self.local_id).delete()
     self.reindex(remove=True)
     super(Account, self).delete(*args, **kwargs)
开发者ID:peterashe,项目名称:engineclub,代码行数:15,代码来源:models.py

示例2: resource_report

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import objects [as 别名]
def resource_report(request, object_id, template_name='depot/resource_report.html'):
    """
    View for reporting a report when a user finds a problem with it.
    """
    resource = get_one_or_404(Resource, id=ObjectId(object_id))
    reporter=get_account(request.user.id)

    # if 'next' in request.GET:
    #     url = request.GET['next']
    # else:
    #     url = None
    # url = url or reverse('resource', args=[resource.id])

    if Issue.objects(reporter=reporter, related_document=resource).count():
        messages.warning(request, 'You have already reported this resource.')
        return HttpResponseRedirect(reverse('resource', args=[resource.id]))

    if request.method == 'POST':
        form = ResourceReportForm(request.POST)
        if form.is_valid():

            severity=int(form.cleaned_data['severity'])
            message=form.cleaned_data['message']

            issue = Issue(
                message=message,
                severity=severity,
                reporter=reporter)
            issue.related_document = resource
            issue.save()
            issue.notify_created()
            
            # only moderate as STATUS_BAD if SEVERITY_CRITICAL
            if severity == SEVERITY_CRITICAL:
                resource.moderate_as_bad(reporter)

            return HttpResponseRedirect(reverse('issue_detail', args=[issue.id]))
    else:
        form = ResourceReportForm()

    return render_to_response(template_name, {
        'next': urlquote_plus(request.GET.get('next', '')),
        'form': form,
        'object': resource,
    }, RequestContext(request))
开发者ID:majailievska,项目名称:engineclub,代码行数:47,代码来源:views.py

示例3: issue_status

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import objects [as 别名]
def issue_status(resource):
    result = -1
    for issue in Issue.objects(related_document=resource, resolved=0):
        result = issue.severity if issue.severity > result else result
    return result
开发者ID:majailievska,项目名称:engineclub,代码行数:7,代码来源:depot_tags.py


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