Enhancements to Admin (#524)

* Add columns to the IgnoreEmail admin page including a calculated column of the queues the ignore relates to.

* Add columns to the IgnoreEmail admin page
including a calculated column of the queues the ignore relates to.

* Revert "Merge pull request #519 from mrkiwi-nz/master"

This reverts commit 410f59ad16, reversing
changes made to fde06d3ab1.

* Add columns to the IgnoreEmail admin page
including a calculated column of the queues the ignore relates to.

* Merge pull request #519 from mrkiwi-nz/master

Added some helpful columns and filters to the follow-up list page.

* Add more columns to the IgnoreEmail admin page
including a calculated column of the queues the ignore relates to.
This commit is contained in:
Daryl Egarr 2017-06-20 06:34:36 +12:00 committed by Garret Wassermann
parent 410f59ad16
commit ef0ba19a3b
2 changed files with 15 additions and 1 deletions

View File

@ -65,7 +65,11 @@ class EmailTemplateAdmin(admin.ModelAdmin):
list_filter = ('locale', )
@admin.register(IgnoreEmail)
class IgnoreEmailAdmin(admin.ModelAdmin):
list_display = ('name', 'queue_list', 'email_address', 'keep_in_mailbox')
admin.site.register(PreSetReply)
admin.site.register(EscalationExclusion)
admin.site.register(KBCategory)
admin.site.register(IgnoreEmail)

View File

@ -1199,6 +1199,16 @@ class IgnoreEmail(models.Model):
self.date = timezone.now()
return super(IgnoreEmail, self).save(*args, **kwargs)
def queue_list(self):
"""Return a list of the queues this IgnoreEmail applies to.
If this IgnoreEmail applies to ALL queues, return '*'.
"""
queues = self.queues.all().order_by('title')
if len(queues) == 0:
return '*'
else:
return ', '.join([str(q) for q in queues])
def test(self, email):
"""
Possible situations: