newmediamonitoring/monitor/views.py

113 lines
3.9 KiB
Python

from django.shortcuts import render
# Create your views here.
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita, \
Douyin, Douyin_data
def new_media_public_opinion_weixin(request):
weixin = Weixin.objects.all()
group = Group.objects.all()
weixin_data = Weixin_data.objects.all().order_by('-comment')
res = []
for w in weixin_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weixin.code
o['image'] = w.weixin.image
o['title'] = w.title
o['comment'] = w.comment
o['reply'] = w.reply
o['year'] = w.year
o['month'] = w.month
o['day'] = w.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weixin.html', {'res':res,'weixin':weixin,'group':group})
def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all()
group = Group.objects.all()
toutiao_data = Toutiao_data.objects.all().order_by('-count')
res = []
for t in toutiao_data:
o = dict()
o['id'] = str(t.id)
o['code'] = t.toutiao.code
o['image'] = t.toutiao.image
o['title'] = t.title
o['count'] = t.count
o['commentcount'] = t.commentcount
o['reply'] = t.reply
o['year'] = t.year
o['month'] = t.month
o['day'] = t.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-toutiao.html', {'res':res,'toutiao':toutiao,'group':group})
def new_media_public_opinion_douyin(request):
douyin = Douyin.objects.all()
group = Group.objects.all()
douyin_data = Douyin_data.objects.all().order_by('-comment')
res = []
for d in douyin_data:
o = dict()
o['id'] = str(d.id)
o['code'] = d.newmedia.code
o['image'] = d.newmedia.image
o['count'] = d.count
o['count_jc'] = d.count_jc
o['comment'] = d.comment
o['reply'] = d.reply
o['date'] = d.date
res.append(o)
return render(request, 'monitor/new-media-public-opinion-douyin.html', {'res':res,'douyin':douyin,'group':group})
def new_media_public_opinion_weibo(request):
weibo = Weibo.objects.all()
group = Group.objects.all()
weibo_data = Weibo_data.objects.all().order_by('-like')
res = []
for w in weibo_data:
o = dict()
o['id'] = str(w.id)
o['code'] = w.weibo.code
o['image'] = w.weibo.image
o['title'] = w.title
o['like'] = w.like
o['transpond'] = w.transpond
o['comment'] = w.comment
o['year'] = w.year
o['month'] = w.month
o['day'] = w.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-weibo.html', {'res':res,'weibo':weibo,'group':group})
def new_media_public_opinion_qita(request):
qita = Qita.objects.all()
group = Group.objects.all()
qita_jc = Qita_jc.objects.all().order_by('-comment')
res = []
for q in qita_jc:
o = dict()
o['id'] = str(q.id)
o['type'] = q.qita.type
o['name'] = q.qita.name
o['image'] = q.qita.image
o['count'] = q.count
o['count_jc'] = q.count_jc
o['comment'] = q.comment
o['reply'] = q.reply
o['year'] = q.year
o['month'] = q.month
o['day'] = q.day
res.append(o)
return render(request, 'monitor/new-media-public-opinion-qita.html', {'res':res,'qita':qita,'group':group})
def timeliness_monitoring(request):
return render(request,'monitor/timeliness-monitoring.html')
def error_monitoring(request):
return render(request, 'monitor/error-monitoring.html')
def sensitive_word_monitoring(request):
return render(request,'monitor/sensitive-word-monitoring.html')
def comment_on_interactive_monitoring(request):
return render(request,'monitor/comment-on-interactive-monitoring.html')
def monitoring_report(request):
return render(request,'monitor/monitoring-report.html')