本文整理汇总了Python中issues.models.Issue.can_declare方法的典型用法代码示例。如果您正苦于以下问题:Python Issue.can_declare方法的具体用法?Python Issue.can_declare怎么用?Python Issue.can_declare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类issues.models.Issue
的用法示例。
在下文中一共展示了Issue.can_declare方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import can_declare [as 别名]
def create(request):
sunetid = request.user.webauth_username
attrs = request.POST.copy()
if len(attrs) == 0 or 'kind' not in attrs:
return HttpResponseNotFound("The form did not submit correctly. Please try again.")
new_issue = Issue(kind=attrs['kind'], sunetid1=sunetid).get_typed()
form = form_class_for_issue(new_issue)(attrs, instance=new_issue)
if form.is_valid() and new_issue.can_declare():
form.save()
return HttpResponseRedirect(reverse('issues.views.manage_index'))
else:
return render_to_response('issues/manage/new.html', {'new_issue': new_issue, 'form': form,'error': True}, context_instance=RequestContext(request))