diff --git a/chapter2/mysite/myapp/templates/myapp/result.html b/chapter2/mysite/myapp/templates/myapp/result.html index 8e36d4a..1a3ab2f 100644 --- a/chapter2/mysite/myapp/templates/myapp/result.html +++ b/chapter2/mysite/myapp/templates/myapp/result.html @@ -6,6 +6,12 @@ Spark大型电商大数据分析 + + + + diff --git a/chapter2/mysite/myapp/views.py b/chapter2/mysite/myapp/views.py index 91efef5..c892ccd 100644 --- a/chapter2/mysite/myapp/views.py +++ b/chapter2/mysite/myapp/views.py @@ -1,7 +1,7 @@ from django.shortcuts import render from django.http import HttpResponse from . import scrapy_client -from myapp.models import CrawlInfos,PlatformInfos, News,LastDayCounts +from myapp.models import CrawlInfos,PlatformInfos, News,LastDayCounts, Datas from myapp.utils import get_platform_info import json @@ -28,6 +28,5 @@ def crawl(request): "last_day_comment": json.dumps(last_day_comment)}) def result(request): - - - return render(request, 'myapp/result.html') \ No newline at end of file + from_type_info = json.loads(Datas.objects.filter(key='from_type').first().data) + return render(request, 'myapp/result.html', {"from_type_info": from_type_info}) \ No newline at end of file