How to replace a comma with an underscore in Django template filter
<p>Hi I have javascript as follows contains django variables. </p>

<pre><code>&lt;script&gt;

$(document).ready(function() {
    {% for a in all_results %}
            $('#{{a.set|slice:":7"}}_{{ a.item }}_{{ a.kidu|slice:":2" }}').html('&lt;a class="a1" href="{% url 'req_detail_view' a.id %}"&gt;{{ a.id }}&lt;/a&gt;');
            $('#{{a.set|slice:":7"}}_{{ a.item}}_{{ a.kidu|slice:":2" }}').addClass('{{ a.state__name.split|join:"_" }}');
    {% endfor %}
});
&lt;/script&gt;
</code></pre>

<p>all results are a query result fro my view:</p>

<pre><code>context['all_results'] = m.values('set', 'kidu', 'id', 'item', 'state__name')
</code></pre>

<p>The problem am facing is if the value of item is a comma separated value, then the id is not passing to the template I have. But if the value of item is a one word my code is working perfectly and the id is passing to the template. Any idea guys?</p>