Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django and wrap lines problem

Tags:

python

django

I've a problem from many years.

The problem is a long text not separated by white spaces in a div. No wrap is applied and it breaks all layout.

How can I fix in django in a good way?

This is what I see:

enter image description here

like image 304
Fred Collins Avatar asked Jul 17 '11 03:07

Fred Collins


1 Answers

As I understand the question it is HTML-side problem, not django-side. For HTML solution look How to word wrap text in HTML?. If you still want to wrap text in python code, textwrap.wrap will help you.

Also there is convenient template tag for this: wordwrap. It uses django.utils.text.wrap function which seems more suitable for using in Django projects.

like image 130
Kirill Avatar answered Sep 25 '22 13:09

Kirill