Search code examples
djangodataframelistdjango-templatesdjango-filter

Removing List tag and single quotes in django template


I've created dataframe. Showing that data on front end side using django templates.

Like mentioned here: enter image description here

In that dataframe getting list for Business Segment column.

But I want to remove that list and single quotes and show it like Bag | Cement.

How can I do this using django template filters?


Solution

  • You can use Django's template tag join to concat your list values with characters of your choice:

    {{ business_segment_list|join:" | " }}