你知道爲什麼它會在返回行中聲明無效的語法嗎?一切似乎都沒問題,我檢查了一下。如果縮進是一個問題,我用空格替換了製表符。SyntaxError語法無效(views.py,第52行)
def detail(request, sl):
try:
post = Post.objects.filter(slug=sl)[0]
try:
previous_post = post.get_previous_by_published()
except:
previous_post = ""
try:
next_post = post.get.next_by_published()
except:
next_post = ""
return render_to_response('blog/detail.html',{'post':post,
'next_post':next_post,
'previous_post':previous_post,
},)
在此先感謝。
對於無效語法,請嘗試在返回語句 –
結束時刪除','(逗號)不,我仍然收到錯誤 – tamara