本文整理匯總了Python中models.Ticket.description方法的典型用法代碼示例。如果您正苦於以下問題:Python Ticket.description方法的具體用法?Python Ticket.description怎麽用?Python Ticket.description使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Ticket
的用法示例。
在下文中一共展示了Ticket.description方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: new_ticket
# 需要導入模塊: from models import Ticket [as 別名]
# 或者: from models.Ticket import description [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)