第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

最后一篇文章在主頁(yè)有顯示,但是點(diǎn)擊后跳轉(zhuǎn)失敗,其它文章正常

<!DOCTYPE?html>
<html?lang="en">
<head>
????<meta?charset="UTF-8">
????<title>Blog</title>
?<!--?最新版本的?Bootstrap?核心?CSS?文件?-->
?<link?rel="stylesheet"?
?integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"?crossorigin="anonymous">
?<!--?最新的?Bootstrap?核心?JavaScript?文件?-->
?<script?src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"
?integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
?crossorigin="anonymous"></script>
</head>
<body>
<div?class="container?page-header">
????<h1>{{?curr_article.title?}}</h1>
</div>
<div?class="container?body-main">
????<div>
?{%?for?section?in?section_list?%}
????????????<p>{{?section?}}</p>
?{%?endfor?%}
????</div>
</div>
<div>
????<nav?aria-label="...">
????????<ul?class="pager">
????????????<li><a?href="/blog/detail/{{?previous_article.article_id?}}">Previous:{{?previous_article.title?}}</a></li>
????????????<li><a?href="/blog/detail/{{?next_article.article_id?}}">Next:{{?next_article.title?}}</a></li>
????????</ul>
????</nav>
</div>


</body>
</html>


正在回答

2 回答

我也是遇到了一樣的問題 在內(nèi)容顯示判斷里面加個(gè)判斷 是否是最后一篇文章 再對(duì)內(nèi)容進(jìn)行查詢

if?article.article_id?==?article_id:

????if?next_index?==?len(all_article):
????????previous_article?=?all_article[(previous_index-1)]
????????next_article?=?all_article[next_index-1]

????else:
????????previous_article?=?all_article[previous_index]
????????next_article?=?all_article[next_index]

????curr_article?=?article
????break


http://img1.sycdn.imooc.com//5d7765bd0001baff11530544.jpg

0 回復(fù) 有任何疑惑可以回復(fù)我~

你是views.py文件里估計(jì)寫的有點(diǎn)問題?

for?index,?article?in?enumerate(all_article):
????if?index?==?0:
????????previous_index?=?index
????????next_index?=?index?+?1

????else:
????????previous_index?=?index?-?1
????????next_index?=?index?+?1

????if?article.article_id?==?article_id:
????????curr_article?=?article
????????previous_article?=?all_article[previous_index]
????????next_article?=?all_article[next_index]
????????break

看我這里加粗的部分!

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

最后一篇文章在主頁(yè)有顯示,但是點(diǎn)擊后跳轉(zhuǎn)失敗,其它文章正常

我要回答 關(guān)注問題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)