Remove duplicate list in jinja

Im populating my html page using jinja, how can I remove duplication from output like using set() in python?

below is my code :

<label for="search_type">Selected Status : </label>
{% for project_data in project_on_status_list %} <span>{{ project_data.get_project_stage_display }}, </span>
{% endfor %}


Output :

Selected Status : In Progress, On Hold, On Hold, Completed,

Desired Output :

Selected Status : In Progress, On Hold, Completed,
8

1 Answer

You need filter unique

`<label for="search_type">
Selected Status :
</label>
{% for project_data in project_on_status_list %}
<span>{{ project_data.get_project_stage_display | unique }}, </span>
{% endfor %}`
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like