这是我的detail_veiw.html
{% extends 'mysite/base.html' %}
{% block content %}
<div class="post">
<div class="date">
{{ post.pub_date }}
</div>
<h1>{{ post.product }}</h1>
<p>{{ post.description|linebreaksbr }}</p>
</div>
{% endblock %}
<a class="btn btn-default" href="{% url 'post_edit' pk=post.pk %}"><span class="glyphicon glyphicon-pencil"></span></a>
所以......我的目的是展示pub_date,产品,描述 但是,下面是Post的Detail_view的屏幕截图 如你所见,我只显示pub_date ...
这就是detail_views的样子
def post_detail(request, pk):
post = get_object_or_404(Post, pk=pk)
return render(request, 'mysite/post_detail.html', {'post':Post})
答案 0 :(得分:0)