0

Django でブログ スクリプトを開発しようとしています。しかし、投稿リンクを表示したい場合、NoReverseMatch エラーが発生します。

私のviews.py

# -*- coding: utf-8 -*-

# Create your views here.

from .models import Yazi, Yorum, Kategori
from django.http import HttpResponse, Http404
from django.shortcuts import render_to_response
from django.template import RequestContext, loader
from django.contrib.sites.models import Site

def Home(request):
    try:
        posts = Yazi.objects.filter(yayinlanmis=True).order_by('-yayinlanma_tarihi')
    except Yazi.DoesNotExist:
        raise Http404
    site = Site.objects.get_current()

    c = RequestContext(request,{
        'posts':posts,
        'site':site
        })
    return render_to_response('Penguencik_Yazilar/yazi_list.html', c)

def Detail(request, slug):
    post = Yazi.objects.get(slug=slug)
    site = Site.objects.get_current()

    c= RequestContext(request,{
        'posts':post,
        'site':site
        })
    return render_to_response('Penguencik_Yazilar/yazi_detail.html',c)

アプリケーション フォルダー内の Urls.py。

from django.conf.urls import patterns, url
import views

urlpatterns = patterns('',
    url(r'^$', views.Home,name='index'),
    url(r'^/makale/(?P<slug>[0-9A-Za-z._%+-]+)$', views.Detail,name='detail'),
)

プロジェクト フォルダー内の Urls.py

from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    url(r'^$', include('Penguencik_Yazilar.urls',namespace='blog')),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

そしてテンプレートコード。私は何を間違っていますか?

{% load url from future %}
...
<a href="{% url 'blog:detail' yazi.slug %}">Read</a>

エラー

4

1 に答える 1