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


Python Ticket.summary方法代码示例

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


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

示例1: new_ticket

# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import summary [as 别名]
def new_ticket(request, *arg):
    """
    For generating new tickets
    """
    if request.method == 'POST':
        form = TicketForm(request.POST)
        if form.is_valid():
            t = Ticket()
            t.ticket_type = form.cleaned_data['ticket_type']
            t.project = form.cleaned_data['project']
            t.component = form.cleaned_data['component']
            t.summary = form.cleaned_data['summary']
            t.description = form.cleaned_data['description']
            t.created_by = request.user
            t.updated_by = request.user
            # workflow related stuff
            ticket_type = t.ticket_type
            wm = WorkflowManager()
            wm.workflow = ticket_type.workflow
            wm.created_by = request.user
            wm.save()
            r = Role.objects.get(id=settings.ROLE_SUBMITTER)
            p = Participant()
            p.user = request.user
            p.role = r
            p.workflowmanager=wm
            p.save()
            t.workflow_manager=wm
            t.save()
            wm.start(p)
            # Generates a confirmation email to send to the new user
            current_site = Site.objects.get_current() 
            site_name = current_site.name
            domain = current_site.domain
            tplt = loader.get_template(settings.NEW_TICKET_EMAIL_TEMPLATE)
            c = {
                'email': request.user.email,
                'domain': domain,
                'site_name': site_name,
                'user': request.user,
                'protocol': settings.REGISTRATION_USE_HTTPS and 'https' or 'http',
                'ticket': t,
            }
            send_mail(_("Confirmation of new ticket on IssueTracker"),
                tplt.render(Context(c)), None, [request.user.email])
            
            request.user.message_set.create(message=_("The ticket has been"\
                    " successfully created."))
            return HttpResponseRedirect('/ticket/%d'%t.id)
    else:
        form = TicketForm()
    c = RequestContext(request, {'form': form})
    return render_to_response('new.html', c) 
开发者ID:ntoll,项目名称:IssueTracker,代码行数:55,代码来源:views.py


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