From 5a0c0284b85a13255f86513565d145ebecfa9637 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Perrin?= Date: Sun, 6 Nov 2016 09:46:53 +0000 Subject: [PATCH] Simplify import --- quotes/tagcloud.py | 2 +- quotes/test_quotes.py | 2 +- quotes/views.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/quotes/tagcloud.py b/quotes/tagcloud.py index 0e80984..8a958f2 100644 --- a/quotes/tagcloud.py +++ b/quotes/tagcloud.py @@ -14,4 +14,4 @@ def build_cloud(): for tag in tags: tag.size = int(10 * float(tag.num_quotes) / maxtag) - return tags + return {'cloud': tags} diff --git a/quotes/test_quotes.py b/quotes/test_quotes.py index ac53979..b4c7915 100644 --- a/quotes/test_quotes.py +++ b/quotes/test_quotes.py @@ -37,7 +37,7 @@ class Test_Views(): a2 = Author.objects.create(name="Author without notes") w2 = Work.objects.create(name="Work without notes", author=a2) q2 = Quote.objects.create(text="

Quote02, no tags

", work=w2) - assert len(q2.tags.all()) == 0 + assert q2.tags.all().count() == 0 def test_all(self, c): content = c.getPage('all/') diff --git a/quotes/views.py b/quotes/views.py index a0969c1..9ff7aac 100644 --- a/quotes/views.py +++ b/quotes/views.py @@ -3,8 +3,8 @@ from django.shortcuts import render from random import randint from quotes.models import Author, Work, Quote, QuoteTag -import quotes.search as search -import quotes.tagcloud as tagcloud +from quotes import search +from quotes import tagcloud from quotes.massimport import domassimport # create your views here. @@ -51,7 +51,7 @@ def searchpage(request): def cloud(request): clouddata = tagcloud.build_cloud() - return render(request, 'quotes/cloud.html', { 'cloud': clouddata }) + return render(request, 'quotes/cloud.html', clouddata) def massimport(request): if 'quotes' in request.POST: -- 2.43.0