UPD
This commit is contained in:
parent
d3c1c3046b
commit
a2252bd5ef
@ -18,7 +18,7 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="header" class="page-header block">
|
||||
<div id="header">
|
||||
<a id="logo" href="/">Django Blog</a>
|
||||
<div id="search">
|
||||
<form id="search-form">
|
||||
@ -31,6 +31,13 @@
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
<div class="sidemenu">
|
||||
<h2>Меню</h2>
|
||||
<ul>
|
||||
<li><li> <a href="{% url 'post_new' %}">new post</a></li>
|
||||
<li> <a href="/blog/1"> all notes</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="sidemenu">
|
||||
<h2>Последние</h2>
|
||||
<ul>
|
||||
<li><a href="/">ToDo List</a><div class="date">2017-11-04</div></li>
|
||||
|
@ -22,6 +22,5 @@
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
@ -2,6 +2,7 @@ from django.conf.urls import url
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.post_list, name='post_list'),
|
||||
url(r'^(?P<page>[0-9]+)/$', views.post_list, name='post_list'),
|
||||
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail, name='post_detail'),
|
||||
url(r'^new/$', views.post_new, name='post_new'),
|
||||
|
@ -8,7 +8,7 @@ from .forms import PostForm
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
def post_list(request, page):
|
||||
def post_list(request, page='1'):
|
||||
post_list = Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')#[int(page)*5-5:int(page)*5]
|
||||
paginator = Paginator(post_list, 5)
|
||||
page = request.GET.get('page')
|
||||
|
Loading…
Reference in New Issue
Block a user