Search code examples
djangodjango-templatesdjango-template-filters

Django: TemplateSyntaxError: Could not parse the remainder: '|' from 'eligibility_date|'


I am using below code in one of my templates. and getting the error TemplateSyntaxError: Could not parse the remainder: '|' from 'eligibility_date|'. I have searched a lot and could not find any usage of date filter with {% with %} {% endwith %}. `

{% with eligibility_date=eligibility_date|date: "m/d/Y" %}
    {% blocktrans %} {{eligibility_date}} {% endblocktrans %}
{% endwith %}

Solution

  • There shouldn't be space between date and "m/d/Y":

    {% with eligibility_date=eligibility_date|date:"m/d/Y" %}