Replace comma by newline using django

I am using django and python.

I am passing post from views and I am displaying destination as {{post.destination}} using django template. If the database value for destination is "Shakespeare,Edison,Fleming" I need to replace ',' by new line.

Anyone help me.


There is not one step solution for this.

What you can do is, in your view make a string replacing ',' with '\n' and use it in template to show as line breaks.


in view:

 new_destination = post.destination.replate(',', '\n')

In template, use linebreaksbr filter which puts <br/> tag for each new line.


Need Your Help

SpriteKit - iOS 7 - iAd Integration Error

ios objective-c ios7 sprite-kit iad

I am trying to integrate iAd with my current sprite kit project. I have scoured existing questions, most of which say adding

Java StackOverflowError while recursively building an array from a binary search tree

java binary-tree rebuild stack-overflow

I'm trying to balance a BST by first building an array (inorder) and then rebuild the entire tree from my array.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.