【问题标题】:Django: TemplateSyntaxError: Could not parse the remainder: '|' from 'eligibility_date|'Django:TemplateSyntaxError:无法解析剩余部分:'|'来自“资格日期|”
【发布时间】:2018-11-06 16:04:25
【问题描述】:

我在我的一个模板中使用以下代码。并得到错误TemplateSyntaxError: Could not parse the remainder: '|' from 'eligibility_date|'. 我搜索了很多,找不到date 过滤器和{% with %} {% endwith %} 的任何用法。 `

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

【问题讨论】:

    标签: django django-templates django-template-filters


    【解决方案1】:

    date"m/d/Y" 之间不应有空格:

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

    【讨论】:

      猜你喜欢
      • 2013-10-26
      • 2022-10-05
      • 2021-01-02
      • 2021-12-20
      • 1970-01-01
      • 2015-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多