parse the remainder: 'date::'Y /m /d''"/>
Django 出现:Could not parse the remainder: 'date::'Y /m /d''
在项目中练习中使用动态Url的时候在日期format的时候出现:
Could not parse the remainder: ‘:date:’Y /m /d” from ‘post.date_time:date:’Y /m /d”
这里主要是自己跟着练习的时候出现疏忽了,原代码是:
{% extends "base.html"%}
{% block content %}
<div class="posts"><section class="post"><header class="post-header"><h2 class="post-title">{{post.title}}</h2><--!主要是这里出现了问题--><p class="post-meta">Time: <a class="post-author" href="#">{{post.date_time:date:'Y /m /d'}}</a><a class="post-category-js" href="#">{{post.category}}</a></p><div class="post-description"><p>{{post.content}}</p></div></header></section>
</div>
{% endblock %}
修改后的代码为:
<p class="post-meta">Time: <a class="post-author" href="#">{{post.date_time|date:'Y /m /d'}}</a><a class="post-category-js" href="#">{{post.category}}</a></p>
主要是把::
改为|
了, 这样子就解决了日期format的问题。
更多推荐
Django 出现:Could not parse the remainder: 'date::'Y /m /d''
发布评论