Skip to content

Commit

Permalink
show pk in str
Browse files Browse the repository at this point in the history
  • Loading branch information
wooyek committed May 7, 2018
1 parent 204181f commit 29b72a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/django_email_queue/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class QueuedEmailMessage(models.Model):
# TODO: attachments, headers, alternatives

def __str__(self):
return u"{}:{}:{}".format(self.__class__.__name__, self.subject, self.to)
return u"{}:{}:{}:{}".format(self.__class__.__name__, self.pk, self.subject, self.to)

@classmethod
def _create(cls, email_message, commit=True):
Expand Down
6 changes: 5 additions & 1 deletion tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ def test_no_recipients(self):

def test_str(self):
o = QueuedEmailMessage(subject="ążśźćń󳥯ŚŹĘĆŃÓŁ", to="b")
self.assertEqual(u"QueuedEmailMessage:ążśźćń󳥯ŚŹĘĆŃÓŁ:b", six.text_type(o))
self.assertEqual(u"QueuedEmailMessage:None:ążśźćń󳥯ŚŹĘĆŃÓŁ:b", six.text_type(o))

def test_str2(self):
o = QueuedEmailMessage(subject="ążśźćń󳥯ŚŹĘĆŃÓŁ", to="b", pk=123)
self.assertEqual(u"QueuedEmailMessage:123:ążśźćń󳥯ŚŹĘĆŃÓŁ:b", six.text_type(o))

@override_settings(EMAIL_QUEUE_DISCARD_HOURS=2)
@patch('django_email_queue.models.QueuedEmailMessage._send')
Expand Down

0 comments on commit 29b72a3

Please sign in to comment.