[Django]-Is it possible to use a django filter on the result of a templatetag?

0👍

Yes, if course you can. Filters are just functions that can be imported. Import the filter function you need from django.template.defaultfilters and pass your arguments to it.

10👍

You can wrap your custom templatetag with ‘filter’ templatetag:

{% filter date %}
    {% your_custom_tag %}
{% endfilter %}

More information here: https://docs.djangoproject.com/en/dev/ref/templates/builtins/#filter

Leave a comment