def form_valid(self, form): message = TicketMessage(user=self.request.profile, body=form.cleaned_data['body'], ticket=self.object) message.save() if event.real: event.post( 'tickets', { 'type': 'ticket-message', 'id': self.object.id, 'message': message.id, 'user': self.object.user_id, 'assignees': list(self.object.assignees.values_list('id', flat=True)), }) event.post('ticket-%d' % self.object.id, { 'type': 'ticket-message', 'message': message.id, }) return HttpResponseRedirect( '%s#message-%d' % (reverse('ticket', args=[self.object.id]), message.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()) 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): message = TicketMessage(user=self.request.profile, body=form.cleaned_data['body'], ticket=self.object) message.save() link = '%s#message-%d' % (reverse('ticket', args=[self.object.id ]), message.id) notify_list = list( chain(self.object.assignees.all(), [self.object.user])) add_ticket_notifications(notify_list, message.user, link, self.object) if event.real: event.post( 'tickets', { 'type': 'ticket-message', 'id': self.object.id, 'message': message.id, 'user': self.object.user_id, 'assignees': list(self.object.assignees.values_list('id', flat=True)), }) event.post('ticket-%d' % self.object.id, { 'type': 'ticket-message', 'message': message.id, }) return HttpResponseRedirect(link)
def form_valid(self, form): message = TicketMessage(user=self.request.user.profile, body=form.cleaned_data['body'], ticket=self.object) message.save() link_url = '%s#message-%d' % (reverse('ticket', args=[self.object.id ]), message.id) messages = self.object.messages.select_related('user__user') assignees = self.object.assignees.select_related('user') user_list = set([m.user.user.username for m in messages] + [u.user.username for u in assignees]) user_list.remove(self.request.user.username) new_notifications( user_list, ('%s: <a href=\"%s\">%s</a>') % (_('Replied ticket for'), link_url, self.object.title)) if event.real: event.post( 'tickets', { 'type': 'ticket-message', 'id': self.object.id, 'message': message.id, 'user': self.object.user_id, 'assignees': list(self.object.assignees.values_list('id', flat=True)), }) return HttpResponseRedirect(link_url)
def form_valid(self, form): message = TicketMessage(user=self.request.user.profile, body=form.cleaned_data['body'], ticket=self.object) message.save() if event.real: event.post('tickets', { 'type': 'ticket-message', 'id': self.object.id, 'message': message.id, 'user': self.object.user_id, 'assignees': list(self.object.assignees.values_list('id', flat=True)), }) return HttpResponseRedirect('%s#message-%d' % (reverse('ticket', args=[self.object.id]), message.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()) 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): message = TicketMessage(user=self.request.profile, body=form.cleaned_data['body'], ticket=self.object) message.save() if event.real: event.post('tickets', { 'type': 'ticket-message', 'id': self.object.id, 'message': message.id, 'user': self.object.user_id, 'assignees': list(self.object.assignees.values_list('id', flat=True)), }) event.post('ticket-%d' % self.object.id, { 'type': 'ticket-message', 'message': message.id, }) if self.request.profile == self.object.user: logger.info('New ticket message for %s by the ticket creator', self.request.build_absolute_uri(reverse('ticket', args=[self.object.id]))) return HttpResponseRedirect('%s#message-%d' % (reverse('ticket', args=[self.object.id]), message.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]))