0
으로하여 DateField를 필터링 내가 사용 장고 1.5.8장고 : 템플릿
내가 코드를 다음과 같이 템플릿에 Datefield
유형의 데이터를 필터링하고 싶습니다.
- 는 장고의에 의해
{% if article.created >= (now - 7 days) %}
을 처리 할 수있는 솔루션이 있습니까 - 오래된 기사
date
형식
some_template.html
{% for article in articles %}
{# recent articles #}
{% if article.created >= (now - 7 days) %}
{{ article.created|timesince }}
{# old articles more than one week past #}
{% else %}
{{ article.created|date:"m d" }}
{% endif %}
{% endfor %}
로 표현 최근 기사 timesince
형식으로 표현 자신의 템플릿 태그?
또는 새 맞춤 필터를 만들어야합니까?