1

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!

1 Answer 1

1

You made a little mistake:

Right:

\n

Wrong:

/n

There is also different ways:

Take a look here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.