Would like to achieve this, example:
models.py
class Theory(models.Model):
sort = models.PositiveIntegerField(default=1, blank=False, null=False)
title = models.CharField(max_length=500)
title_url = models.SlugField(max_length=500)
graphics = models.ImageField(upload_to='theory', blank=True)
description = RedactorField(blank=True)
def __unicode__(self, ):
return self.title
Inside the
description = RedactorField(blank=True)
will be always UL that has 3, 10, 8 or other amount of <li>
tags. Maybe later will be added couple paragraphs, but for now there is only UL for each new Object (Theory)
Let's say my template variable holds description from wysiwyg editor in Django Admin
<ul>
<li>Theory of Relativity</li>
<li>Interstellar</li>
<li>5D</li>
<li>Black Hole</li>
<li>Tesseract</li>
</ul>
index.html
{% for text in space %}
{{ text.description | safe }}
{% endfor %}
This will output the HTML above.
My goal is to do this:
Theory of Relativity, Interstellar, 5D, Black Hole, Tesseract
I know I can do:
{% for text in space %}
{{ text.description | safe | striptags }}
{% endfor %}
Output is going to be:
Theory of RelativityInterstellar5DBlack HoleTesseract
How can I achieve with Django and Python to Striptags + comma separated but precise phrases.
I know I can put commas in the Admin in the editor, but I cannot do that. I need HTML output that I am using as UL somewhere else on the page, but I need also that output.