Skip to content

Commit

Permalink
Use lorem ipsum for test previewer.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaemming committed Sep 27, 2012
1 parent 694aef1 commit adc8387
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mailview/templates/mailview/message.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2>Body (HTML)</h2>

<h2>Body (Plain Text)</h2>

{{ body }}
{{ body|linebreaks }}

</section>

Expand Down
14 changes: 10 additions & 4 deletions mailview/tests/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import random

from django.contrib.webdesign.lorem_ipsum import paragraphs, sentence
from django.template import Context, Template

from mailview.messages import (TemplatedEmailMessageView,
Expand All @@ -14,10 +17,13 @@ def preview(request):
view_cls = TemplatedEmailMessageView

message_view = view_cls()
message_view.subject_template = Template('{{ value }}')
message_view.body_template = Template('{{ value }}')
message_view.subject_template = Template('{{ subject }}')
message_view.body_template = Template('{{ content }}')
if html:
message_view.html_body_template = Template('<b>{{ value }}</b>')
message_view.html_body_template = Template('{{ content|linebreaks }}')

message = message_view.render_to_message(Context({'value': 'Hello, world!'}))
message = message_view.render_to_message(Context({
'subject': sentence(),
'content': '\n'.join(paragraphs(random.randint(3, 6))),
}))
return render_message_to_response(request, message)

0 comments on commit adc8387

Please sign in to comment.