]> gitweb.fperrin.net Git - djsite.git/commitdiff
Simplify import
authorFrédéric Perrin <frederic.perrin@resel.fr>
Sun, 6 Nov 2016 09:46:53 +0000 (09:46 +0000)
committerFrédéric Perrin <frederic.perrin@resel.fr>
Sun, 6 Nov 2016 09:46:53 +0000 (09:46 +0000)
quotes/tagcloud.py
quotes/test_quotes.py
quotes/views.py

index 0e80984de098c9c75841300fe17ff85ba0a438b2..8a958f2a0ec735cb9e8127150a8927877e594b72 100644 (file)
@@ -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}
index ac53979f936f3214cf15adacdcc13c30e682d4e3..b4c79159cd911f2db112b1021ec7599489f58c7f 100644 (file)
@@ -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="<p>Quote02, no tags</p>", work=w2)
-        assert len(q2.tags.all()) == 0
+        assert q2.tags.all().count() == 0
 
     def test_all(self, c):
         content = c.getPage('all/')
index a0969c113699c57724ff5ed1ca2223f9dbc87001..9ff7aacc996bd07db6077490ace90d4b8c7b9d7d 100644 (file)
@@ -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: