1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00

Fix backward compatibility to django<1.5 in Mailbox.get_new_mail

This commit is contained in:
Adam Dobrawy 2016-08-16 01:10:55 +02:00
parent ef88900787
commit fc05ee6505

View file

@ -20,6 +20,7 @@ import uuid
import six
from six.moves.urllib.parse import parse_qs, unquote, urlparse
import django
from django.conf import settings as django_settings
from django.core.files.base import ContentFile
from django.core.mail.message import make_msgid
@ -382,7 +383,10 @@ class Mailbox(models.Model):
msg = self.process_incoming_message(message)
new_mail.append(msg)
self.last_polling = now()
self.save(update_fields=['last_polling'])
if django.VERSION >= (1, 5): # Django 1.5 introduces update_fields
self.save(update_fields=['last_polling'])
else:
self.save()
return new_mail
def __unicode__(self):