From 3e2d92afdeafb47a6caa890292fd07837ad5f130 Mon Sep 17 00:00:00 2001 From: Date: Fri, 8 Dec 2017 01:32:13 +0300 Subject: [PATCH] heroku --- blog/views.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/blog/views.py b/blog/views.py index e5863a8..c9307ac 100644 --- a/blog/views.py +++ b/blog/views.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8 -*- from django.shortcuts import render from .models import Post from django.db.models import Count, Max, Min, Q @@ -13,12 +13,12 @@ import math def cloud(): - min_font = 11 - max_font = 28 - #size = max(min_font, round((min_font+(tag_list[i]-min_w)*step)*(math.log(tag_list[i])/Math.log(max_w)))) - v = Tag.objects.all().annotate(c = Count('post')).filter(c__gt = 0).aggregate(Min('c'), Max('c')) - max_tag, min_tag = v["c__max"], v["c__min"] - step = (max_font - min_font)/float(max_tag-min_tag) + # min_font = 11 + # max_font = 28 + # #size = max(min_font, round((min_font+(tag_list[i]-min_w)*step)*(math.log(tag_list[i])/Math.log(max_w)))) + # v = Tag.objects.all().annotate(c = Count('post')).filter(c__gt = 0).aggregate(Min('c'), Max('c')) + # max_tag, min_tag = v["c__max"], v["c__min"] + # step = (max_font - min_font)/float(max_tag-min_tag) #print step """ tags = Tag.objects.all().annotate( @@ -67,7 +67,7 @@ def post_detail(request, pk): return render(request, 'blog/post_detail.html', {'post': post, 'tags': tags, 'latest': latest, 'cloud': tag_cloud}) -@login_required(login_url="/admin/login/?next=/") +@login_required(login_url="/admin/login/?next=/") def post_new(request): tag_cloud = cloud() latest = Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')[0:9] @@ -85,7 +85,7 @@ def post_new(request): return render(request, 'blog/post_edit.html', {'form': form, 'latest': latest, 'cloud': tag_cloud}) -@login_required(login_url="/admin/login/?next=/") +@login_required(login_url="/admin/login/?next=/") def post_edit(request, pk): tag_cloud = cloud() latest = Post.objects.filter(published_date__lte=timezone.now()).order_by('-published_date')[0:9]