【发布时间】:2021-03-14 02:18:41
【问题描述】:
urls.py
path('posts/',views.posts,name='posts'),
path('<id>',views.detail_view,name='detail_view'),
views.py
def posts(request):
posts = Post.objects.all().order_by('-date_added')
context = {'posts':posts}
return render(request, 'mains/post.html', context)
post.html
{% block content %}
{% for topic in posts %}
<a>{{ topic.description}}</a> <a href="{% url 'mains:detail_view'
topic.post_owner.id %}">Show
More</a><br>
<br>
{% empty %}
No yet.</li>
{% endfor %}
帖子匹配查询不存在。当我单击帖子页面中的 show_more 时,会出现此错误。请帮助我。非常感谢您的帮助。
【问题讨论】:
标签: html django django-views django-templates