python - Line breaks Django string -


is there way display line breaks in rendered django string?

contact_message = "name: %s | email: %s" % (         form_name,         form_email,     ) 

for example, code above prints as:

name: <rendered name> | email: <rendered email> 

is there way make print this:

name: <rendered name> email: <rendered email> 

i using send_mail function, hoping make readability more visually appealing.

thank you!

when sending mail, simple \n should enough:

contact_message = "name: %s\nemail: %s" % (     form_name,     form_email, ) 

this won't work in html, there need html tags , have mark string safe: https://docs.djangoproject.com/en/1.8/ref/utils/#module-django.utils.safestring


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -