本文整理汇总了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)