def form_valid(self, form): ticket = Ticket(user=self.request.user.profile, title=form.cleaned_data['title']) ticket.linked_item = self.object ticket.save() message = TicketMessage(ticket=ticket, user=ticket.user, body=form.cleaned_data['body']) message.save() ticket.assignees.set(self.get_assignees()) if event.real: event.post( 'tickets', { 'type': 'new-ticket', 'id': ticket.id, 'message': message.id, 'user': ticket.user_id, 'assignees': list(ticket.assignees.values_list('id', flat=True)), }) return HttpResponseRedirect(reverse('ticket', args=[ticket.id]))
def form_valid(self, form): ticket = Ticket(user=self.request.user.profile, title=form.cleaned_data['title']) ticket.linked_item = self.object ticket.save() message = TicketMessage(ticket=ticket, user=ticket.user, body=form.cleaned_data['body']) message.save() ticket.assignees.set(self.get_assignees()) link_url = reverse('ticket', args=[ticket.id]) new_notifications( [u.user.username for u in self.get_assignees()], ('%s: <a href=\"%s\">%s</a>') % (_('New ticket was registered'), link_url, ticket.title), 'success') if event.real: event.post( 'tickets', { 'type': 'new-ticket', 'id': ticket.id, 'message': message.id, 'user': ticket.user_id, 'assignees': list(ticket.assignees.values_list('id', flat=True)), }) return HttpResponseRedirect(link_url)
def form_valid(self, form): ticket = Ticket(user=self.request.user.profile, title=form.cleaned_data['title']) ticket.linked_item = self.object ticket.save() message = TicketMessage(ticket=ticket, user=ticket.user, body=form.cleaned_data['body']) message.save() ticket.assignees.set(self.get_assignees()) if event.real: event.post('tickets', { 'type': 'new-ticket', 'id': ticket.id, 'message': message.id, 'user': ticket.user_id, 'assignees': list(ticket.assignees.values_list('id', flat=True)), }) return HttpResponseRedirect(reverse('ticket', args=[ticket.id]))
def form_valid(self, form): ticket = Ticket(user=self.request.profile, title=form.cleaned_data['title']) issue_object = GeneralIssue(issue_url=form.cleaned_data['issue_url']) issue_object.save() ticket.linked_item = issue_object ticket.save() message = TicketMessage(ticket=ticket, user=ticket.user, body=form.cleaned_data['body']) message.save() if event.real: event.post( 'tickets', { 'type': 'new-ticket', 'id': ticket.id, 'message': message.id, 'user': ticket.user_id, 'assignees': [], }) on_new_ticket.delay(ticket.pk, ticket.content_type.pk, ticket.object_id, form.cleaned_data['body']) return HttpResponseRedirect(reverse('ticket', args=[ticket.id]))