upd
This commit is contained in:
parent
d0a960ebb2
commit
d749021b7a
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
a {
|
a {
|
||||||
color: #4a809a;
|
color: #4a809a;
|
||||||
}
|
}
|
||||||
@ -223,10 +224,16 @@ a {
|
|||||||
background-color: rgba(41, 128, 185, 0.1);
|
background-color: rgba(41, 128, 185, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#plus {display: none;}
|
||||||
@media screen and (max-width: 900px) {
|
@media screen and (max-width: 900px) {
|
||||||
#posts {padding: 0}
|
#posts {padding: 0}
|
||||||
#header {width: 98%;}
|
#header {width: 100%;}
|
||||||
//.sidemenu {background: #F7F7F8;}
|
//.sidemenu {background: #F7F7F8;}
|
||||||
#search, .sidemenu {display: none}
|
#search, .sidemenu {display: none}
|
||||||
|
#plus {color: #FFF; float: right;
|
||||||
|
font-size: 25px;
|
||||||
|
display: block;
|
||||||
|
//height: 30px;
|
||||||
|
margin: 12px;
|
||||||
|
}
|
||||||
}
|
}
|
@ -3,10 +3,10 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>BLOG</title>
|
<title>BLOG</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="{% static 'css/blog.css' %}">
|
<link rel="stylesheet" href="{% static 'css/blog.css' %}">
|
||||||
<link rel="stylesheet" href="{% static 'css/new.css' %}">
|
<link rel="stylesheet" href="{% static 'css/new.css' %}">
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -18,6 +18,8 @@
|
|||||||
<input id="button-search" type="submit" value=""></input>
|
<input id="button-search" type="submit" value=""></input>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<a href="{% url 'post_new' %}"><i id="plus" class="fa fa-plus-square"></i></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<div id="posts">
|
<div id="posts">
|
||||||
@ -42,13 +44,13 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="block">
|
<div class="block" style="text-align: center">
|
||||||
<h2> Теги </h2>
|
<h2> Теги </h2>
|
||||||
<ul>
|
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
<li><li><a href="{% url 'post_list' tag=tag %}">{{ tag.name }} : {{ tag.c }}</a></li>
|
<a href="{% url 'post_list' tag=tag %}" style="font-size: {{tag.f}}; margin: 2px ">{{ tag.name }}({{ tag.c }})</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from .models import Post
|
from .models import Post
|
||||||
from django.db.models import Count, Q
|
from django.db.models import Count, Max, Min, Q
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.shortcuts import render, get_object_or_404, render_to_response
|
from django.shortcuts import render, get_object_or_404, render_to_response
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
@ -20,7 +20,7 @@ def post_list(request, page='1', tag=None):
|
|||||||
paginator = Paginator(post_list, 5)
|
paginator = Paginator(post_list, 5)
|
||||||
page = request.GET.get('page')
|
page = request.GET.get('page')
|
||||||
latest = Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')[0:9]
|
latest = Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')[0:9]
|
||||||
tags = Tag.objects.all().annotate(c = Count('post'))
|
tags = Tag.objects.all().annotate(c = Count('post'), f=Count('post')**(1/1.05)+12).filter(c__gt = 0).order_by('name')
|
||||||
try:
|
try:
|
||||||
posts = paginator.page(page)
|
posts = paginator.page(page)
|
||||||
except PageNotAnInteger: # If page is not an integer, deliver first page.
|
except PageNotAnInteger: # If page is not an integer, deliver first page.
|
||||||
|
Loading…
Reference in New Issue
Block a user