views.py
def article(request, article_id):
return render(request, 'article.html', {
'article': Article.objects.get(id=article_id)
})
urls.py
from . import views
urlpatterns = [
path('articles/', views.articles, name='articles'),
path('articles/<int:article_id>/', views.article, name='article'),
]
article.html
<div class="pagination">
<a href="#">«</a>
<a class="active" href="/articles/{{ article.id }}/">1</a>
<a href="/articles/{{ article.id }}/">2</a>
<a href="#">3</a>
<a href="#">4</a>
<a href="#">5</a>
<a href="#">6</a>
<a href="#">»</a>
</div>
Someone can tell me how add to pagination list correct article by correct id and last and end article ID
in HTML?
Thanks a lot
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…