0

I'm attempting to build a linebreak into a string and then render that string in a template with the linebreaks. I'm saving the following string to a model field:

usercart.other_tax_regnum = "State tax reg number" + "/n" + "Second State tax reg number"  
usercart.save()

Then, within my view, I render thefield

 {{ usercart.other_tax_regnum|linebreaks }}

Rather than showing a line break, this is what gets rendered:

State tax reg number/nSecond State tax reg number

Any thoughts on how I can do this?

Thank you!

Jason Howard
  • 1,464
  • 1
  • 14
  • 43

1 Answers1

1

You made a little mistake:

Right:

\n

Wrong:

/n

There is also different ways:

Take a look here

Navid Zarepak
  • 4,148
  • 1
  • 12
  • 26