0
Djangoのバージョンの有効なビュー機能やパターン名ではありません:1.11.4 パイソン:エラー:「詳細」のための反転が見つかりません。 「詳細は」
<a class="pure-button" href="{% url 'detail' id=post.id %}">Read More </a>
ビュー:3.6.1
私は私のhtmlファイルに行を追加します。 PY:
def detail(request, id):
try:
post = Article.objects.get(id=int(id))
except Article.DoesNotExist:
raise Http404
return render(request, 'post.html', {'post':post})
url.py:
from django.conf.urls import url,include
from django.contrib import admin
import article.views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^(\d+)', article.views.detail),
url(r'^', article.views.home),
]
次のエラーが発生しました:
NoReverseMatch at/
Reverse for 'detail' not found. 'detail' is not a valid view function or pattern name.
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.11.4
Exception Type: NoReverseMatch
Exception Value:
Reverse for 'detail' not found. 'detail' is not a valid view function or pattern name.
誰が私を助けることができますか?多くの感謝!
によくエラーが正しい表示...あなたは、詳細という名前のURLを持っていません。 – Sayse
[NoReverseMatchエラーとは何ですか?また修正するにはどうすればいいですか?](https://stackoverflow.com/questions/38390177/what-is-a-noreversematch-error-and-how-do-i-修理する) – Sayse