From b5da29dcfefc14c11c887e501d97433bf2ad2794 Mon Sep 17 00:00:00 2001 From: Ross Poulton Date: Sat, 5 Mar 2011 03:29:01 +0000 Subject: [PATCH] Allow multiple e-mails to be entered for the queue CC email addresses. Separate with a comma. Closes GH-49. --- helpdesk/lib.py | 5 ++++- helpdesk/models.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/helpdesk/lib.py b/helpdesk/lib.py index c48e6e35..e5bc100e 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -102,7 +102,10 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b "{{ ticket.ticket }} {{ ticket.title|safe }} %s" % t.subject ).render(context) - if type(recipients) != list: + if type(recipients) == str: + if recipients.find(','): + recipients = recipients.split(',') + elif type(recipients) != list: recipients = [recipients,] msg = EmailMultiAlternatives( subject_part, diff --git a/helpdesk/models.py b/helpdesk/models.py index 14671e62..bb63db6b 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -80,21 +80,25 @@ class Queue(models.Model): 'increase their priority? Set to 0 for no escalation.'), ) - new_ticket_cc = models.EmailField( + new_ticket_cc = models.CharField( _('New Ticket CC Address'), blank=True, null=True, + max_length=200, help_text=_('If an e-mail address is entered here, then it will ' - 'receive notification of all new tickets created for this queue'), + 'receive notification of all new tickets created for this queue. ' + 'Enter a comma between multiple e-mail addresses.'), ) - updated_ticket_cc = models.EmailField( + updated_ticket_cc = models.CharField( _('Updated Ticket CC Address'), blank=True, null=True, + max_length=200, help_text=_('If an e-mail address is entered here, then it will ' 'receive notification of all activity (new tickets, closed ' - 'tickets, updates, reassignments, etc) for this queue'), + 'tickets, updates, reassignments, etc) for this queue. Separate ' + 'multiple addresses with a comma.'), ) email_box_type = models.CharField(