我觉得自己好像在绊倒。我正在尝试添加 url with-dashes 。我不确定使用非基于类的视图我做错了什么。我不认为我可以渲染像blog_post.as_view()这样的定义,因为它没有它。
有没有人看到明显的错误?
错误消息:
chrome.browserAction.onClicked.addListener(function(tab){
if(toggle===true)
toggle = false;
else if(toggle===false)
toggle = true;
if(toggle===true){
chrome.webRequest.onBeforeRequest.addListener(
function deny(request) {
return {cancel: true};
}, { urls: user, types: [] }, ["blocking"]);
chrome.browserAction.setBadgeText({
text: 'ON'
});
}
else{
chrome.webRequest.onBeforeRequest.removeListener();
chrome.browserAction.setBadgeText({
text: 'OFF'
});
}
});
urls.py
Reverse for 'blog_post' with arguments '(u'i-prefer-debian',)'
and keyword arguments '{}' not found. 1 pattern(s) tried:
['blog/$post/(?P<slug>[\\w-]+)/$']
views.py
url(r'^post/(?P<slug>[\w-]+)/$', 'blog_post', name="blog_post"),
blog_list.html
def blog_post(request, slug):
print 1 # To see if it gets hit
context = {
'post': get_object_or_404(Posts, slug=slug)
}
return render(request, 'blog_post.html', context)
答案 0 :(得分:1)