From 0fa2d450fde2a07a9997fcf0a0875c00379e1e9b Mon Sep 17 00:00:00 2001 From: Alice Date: Mon, 16 Jan 2017 02:54:58 +0000 Subject: [PATCH] Remove notification on ticket close --- tickets/admin.py | 10 +--------- tickets/models.py | 6 ------ tickets/views.py | 1 - 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/tickets/admin.py b/tickets/admin.py index d440994..f26a07f 100644 --- a/tickets/admin.py +++ b/tickets/admin.py @@ -6,15 +6,7 @@ from django.utils import formats from .models import Ticket, TicketMessage, TicketNotifyAddress -def close_without_notice(modeladmin, request, queryset): - queryset.update(is_open=False, closed=timezone.now()) -close_without_notice.short_description = _("Close selected tickets (without notice)") - - def close_tickets(modeladmin, request, queryset): - for t in queryset: - if t.is_open: - t.notify_close() queryset.update(is_open=False, closed=timezone.now()) close_tickets.short_description = _("Close selected tickets") @@ -38,7 +30,7 @@ class TicketAdmin(admin.ModelAdmin): list_display = ('subject', 'user', 'created', 'category', 'is_open') list_filter = ('category', 'is_open') search_fields = ('subject', 'user__username', 'message_set__message') - actions = (close_tickets, close_without_notice) + actions = (close_tickets,) inlines = (TicketMessageAdmin,) def user_link(self, object): diff --git a/tickets/models.py b/tickets/models.py index cc64b7a..8adf035 100644 --- a/tickets/models.py +++ b/tickets/models.py @@ -77,12 +77,6 @@ class Ticket(models.Model): return notify(subject, 'tickets/mail_user_reply.txt', [self.user.email], ctx) - def notify_close(self): - url = ROOT_URL + reverse('tickets:view', args=(self.id,)) - subject = _("Ticket:") + " " + self.subject - ctx = dict(ticket=self, url=url) - notify(subject, 'tickets/mail_user_close.txt', [self.user.email], ctx) - def __str__(self): return self.subject diff --git a/tickets/views.py b/tickets/views.py index 4d0a98b..bb89026 100644 --- a/tickets/views.py +++ b/tickets/views.py @@ -128,7 +128,6 @@ def view(request, id): ticket.is_open = False ticket.closed = timezone.now() ticket.save() - ticket.notify_close() return redirect('tickets:view', id=ticket.id) if request.POST.get('reopen') or request.POST.get('button_reopen'):