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