mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Move the bulk get_new_mail to queryset
This commit is contained in:
parent
505bc8d1c9
commit
0c6f6aa6ce
3 changed files with 27 additions and 7 deletions
|
|
@ -20,11 +20,7 @@ logger = logging.getLogger(__name__)
|
|||
|
||||
|
||||
def get_new_mail(mailbox_admin, request, queryset):
|
||||
count = 0
|
||||
for mailbox in queryset.all():
|
||||
logger.debug('Receiving mail for %s' % mailbox)
|
||||
count += sum(1 for i in mailbox.get_new_mail())
|
||||
logger.debug('Received %d %s.', count, 'mails' if count != 1 else 'mail')
|
||||
queryset.get_new_mail()
|
||||
|
||||
|
||||
get_new_mail.short_description = _('Get new mail')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue