heroku
This commit is contained in:
parent
391ac1beaa
commit
3e2d92afde
|
@ -1,4 +1,4 @@
|
||||||
# -*- 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, Max, Min, Q
|
from django.db.models import Count, Max, Min, Q
|
||||||
|
@ -13,12 +13,12 @@ import math
|
||||||
|
|
||||||
|
|
||||||
def cloud():
|
def cloud():
|
||||||
min_font = 11
|
# min_font = 11
|
||||||
max_font = 28
|
# 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))))
|
# #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'))
|
# 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"]
|
# max_tag, min_tag = v["c__max"], v["c__min"]
|
||||||
step = (max_font - min_font)/float(max_tag-min_tag)
|
# step = (max_font - min_font)/float(max_tag-min_tag)
|
||||||
#print step
|
#print step
|
||||||
"""
|
"""
|
||||||
tags = Tag.objects.all().annotate(
|
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})
|
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):
|
def post_new(request):
|
||||||
tag_cloud = cloud()
|
tag_cloud = cloud()
|
||||||
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]
|
||||||
|
@ -85,7 +85,7 @@ def post_new(request):
|
||||||
return render(request, 'blog/post_edit.html', {'form': form, 'latest': latest, 'cloud': tag_cloud})
|
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):
|
def post_edit(request, pk):
|
||||||
tag_cloud = cloud()
|
tag_cloud = cloud()
|
||||||
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]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user