GouriB
GouriB

Reputation: 13

How to print list as separarte strings in django template

I want to print list as a separate strings in html For example: ['one','two','three']

output- one,two,three

for loop didn't work it prints one letter per line instead one item

I tried slugify but it ads dashes

{{item.notes|slugify}}

Upvotes: 1

Views: 711

Answers (1)

lmiguelvargasf
lmiguelvargasf

Reputation: 69755

If I am guessing correctly, you want to join each element of the list with a comma, assuming your list is stored in value, use the following:

{{ value|join:"," }}

The output will be:

one,two,three

Upvotes: 2

Related Questions