In Django we have a model field called TextField
. and A simple html page which have a tag <textarea id="textarea" cols="10" rows="5" wrap="off"></textarea>
I write Python code in this area and press submit button so that it will be saved in DB. The problem is when I retrieve back from DB it looses its formatting. I will have to show end user as the same format as he entered.
as this can be seen here http://ideone.com/B5AUiQ. I'm not sure about how any other sites like codeacademy, spoj, topcoder, codechef, codepad etc uses this and what could be the best solution.
considering Django and in general both
I found these threads but not clearly shows how to do it in general
How to store formatted text in MySQL table?