[Django]-Removing quotes in a Django template

6👍

This question looks a bit dated, but wanted to toss in a simple solution. You can make a custom template tag and use the replace function.

Example:

@register.filter
def strip_double_quotes(quoted_string):
    return quoted_string.replace('"', '')

{{ my_quoted_string|strip_double_quotes }}

3👍

You can use

                {% for obj in result.object.list_objects %}
                    {{ obj|slice:"1:-1" }}
                {% endfor %}

Leave a comment