diff --git a/management/templates/management/group-management-admin.html b/management/templates/management/group-management-admin.html index 39dbfd2..7d861d4 100644 --- a/management/templates/management/group-management-admin.html +++ b/management/templates/management/group-management-admin.html @@ -43,10 +43,14 @@
{#

矩阵列表

#}
@@ -55,6 +59,7 @@ + @@ -67,8 +72,10 @@ {% for r in res_g_a %} - + + diff --git a/management/templates/management/group-management-init.html b/management/templates/management/group-management-init.html index 4693742..c4bd2a5 100644 --- a/management/templates/management/group-management-init.html +++ b/management/templates/management/group-management-init.html @@ -41,10 +41,14 @@
{#

矩阵列表

#}
@@ -53,6 +57,7 @@
序号 头像 矩阵名称 矩阵类型
{{ forloop.counter }} {{ r.name }} {{ r.type }} {{ r.admin_count }}
+ @@ -65,8 +70,10 @@ {% for r in res_g_i %} - + + diff --git a/management/templates/management/group-management-user.html b/management/templates/management/group-management-user.html index 33b73ae..d71ed22 100644 --- a/management/templates/management/group-management-user.html +++ b/management/templates/management/group-management-user.html @@ -43,10 +43,14 @@
{#

矩阵列表

#}
@@ -55,6 +59,7 @@
序号 头像 矩阵名称 矩阵类型
{{ forloop.counter }} {{ r.name }} {{ r.type }} {{ r.admin_count }}
+ @@ -66,8 +71,10 @@ {% for r in res_g_u %} - + + diff --git a/management/templates/management/newmedia-management-edit-douyin.html b/management/templates/management/newmedia-management-edit-douyin.html index 4cfabed..4f1d05d 100644 --- a/management/templates/management/newmedia-management-edit-douyin.html +++ b/management/templates/management/newmedia-management-edit-douyin.html @@ -31,6 +31,7 @@
序号 头像 矩阵名称 矩阵类型
{{ forloop.counter }} {{ r.name }} {{ r.type }} {{ r.admin_count }}
+ @@ -43,7 +44,9 @@ {% for w in res %} - + diff --git a/management/templates/management/newmedia-management-edit-qita.html b/management/templates/management/newmedia-management-edit-qita.html index 41887b4..e2abc36 100644 --- a/management/templates/management/newmedia-management-edit-qita.html +++ b/management/templates/management/newmedia-management-edit-qita.html @@ -23,7 +23,7 @@

其他新媒体列表

-

其他新媒体总计:{{ qita_count}}

+

其他新媒体总计:{{ qita_count }}

@@ -31,6 +31,7 @@
序号 图标 新媒体名称 新媒体ID
{{ forloop.counter }} {{ w.code }} {{ w.douyinid }}
+ @@ -44,7 +45,9 @@ {% for w in res %} - + diff --git a/management/templates/management/newmedia-management-edit-toutiao.html b/management/templates/management/newmedia-management-edit-toutiao.html index cbe7098..a699ad4 100644 --- a/management/templates/management/newmedia-management-edit-toutiao.html +++ b/management/templates/management/newmedia-management-edit-toutiao.html @@ -31,6 +31,7 @@
序号 图标 新媒体类型 新媒体名称
{{ forloop.counter }} {{ w.type }} {{ w.name }}
+ @@ -43,7 +44,9 @@ {% for w in res %} - + diff --git a/management/templates/management/newmedia-management-edit-weibo.html b/management/templates/management/newmedia-management-edit-weibo.html index 02761f9..73471ac 100644 --- a/management/templates/management/newmedia-management-edit-weibo.html +++ b/management/templates/management/newmedia-management-edit-weibo.html @@ -31,6 +31,7 @@
头条 图标 新媒体名称 新媒体ID
{{ forloop.counter }} {{ w.code }} {{ w.toutiaoid }}
+ @@ -43,7 +44,9 @@ {% for w in res %} - + diff --git a/management/templates/management/newmedia-management-edit-weixin.html b/management/templates/management/newmedia-management-edit-weixin.html index 56dd162..1de8a04 100644 --- a/management/templates/management/newmedia-management-edit-weixin.html +++ b/management/templates/management/newmedia-management-edit-weixin.html @@ -31,6 +31,7 @@
序号 图标 新媒体名称 新媒体ID
{{ forloop.counter }} {{ w.code }} {{ w.weiboid }}
+ @@ -43,7 +44,9 @@ {% for w in res %} - + diff --git a/management/templates/management/news-management.html b/management/templates/management/news-management.html index c26f5b6..16cca3d 100644 --- a/management/templates/management/news-management.html +++ b/management/templates/management/news-management.html @@ -57,6 +57,7 @@
序号 图标 新媒体名称 新媒体ID
{{ forloop.counter }} {{ w.code }} {{ w.weixinid }}
+ @@ -67,7 +68,8 @@ {% for n in news %} - + + diff --git a/management/templates/management/organization-management.html b/management/templates/management/organization-management.html index 5dad58e..f9e36d6 100644 --- a/management/templates/management/organization-management.html +++ b/management/templates/management/organization-management.html @@ -57,6 +57,7 @@
序号 标题 作者 类型
{{ n.title }}{{ forloop.counter }}{{ n.title }} {{ n.author }} {{ n.type }} {{ n.date }}
+ {# #} @@ -69,6 +70,7 @@ {% for r in res %} + diff --git a/management/templates/management/user-management.html b/management/templates/management/user-management.html index 2a03a4e..ab1dfce 100644 --- a/management/templates/management/user-management.html +++ b/management/templates/management/user-management.html @@ -31,11 +31,12 @@
序号 图标 单位名称类型
{{ forloop.counter }}
+ -{# #} + {# #} @@ -43,12 +44,13 @@ {% for u in userallinfo %} - + -{# #} + {# #} - + + - - - - - - - + {% for n in news %} + + + + + + + + + {% endfor %}
序号 头像 姓名 电话 单位名称单位类型单位类型行政区划 操作
{{ forloop.counter }} {{ u.name }} {{ u.phone }} {{ u.organization }}{{ u.type }}{{ u.type }}{{ u.administrativedivision }}
序号时间 发布时间 报告名称发布者来源 预警次数
{{ r.code }}{{ r.comment }}{{ r.reply }}{{ r.date }}{{ r.date }}
{{ forloop.counter }}{{ n.date }}{{ n.title }}{{ n.author }}{{ n.source }}1
diff --git a/monitor/views.py b/monitor/views.py index 2411af4..9351a02 100644 --- a/monitor/views.py +++ b/monitor/views.py @@ -8,7 +8,7 @@ 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 + Douyin, Douyin_data, News from monitor.models import Test @@ -29,7 +29,9 @@ def new_media_public_opinion_weixin(request): 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}) + 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() @@ -49,7 +51,10 @@ def new_media_public_opinion_toutiao(request): 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}) + 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() @@ -66,7 +71,10 @@ def new_media_public_opinion_douyin(request): 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}) + 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() @@ -85,7 +93,8 @@ def new_media_public_opinion_weibo(request): 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}) + 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() @@ -106,15 +115,25 @@ def new_media_public_opinion_qita(request): 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}) + 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') + 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') + return render(request, 'monitor/sensitive-word-monitoring.html') + + def comment_on_interactive_monitoring(request): - return render(request,'monitor/comment-on-interactive-monitoring.html') + return render(request, 'monitor/comment-on-interactive-monitoring.html') + + def comment_on_interactive_monitoring_json(request): data = Test.objects.all()[:500] r = [] @@ -130,25 +149,31 @@ def comment_on_interactive_monitoring_json(request): res = [] for (k, v) in c.most_common(200): # 遍历输出高频词 # print('%s%s %s %d' % (' ' * (5 - len(k)), k, '*', v)) - #剔除不是汉字的值 - if all(map(lambda c:'\u4e00' <= c <= '\u9fa5',k)): + # 剔除不是汉字的值 + if all(map(lambda c: '\u4e00' <= c <= '\u9fa5', k)): o = dict() o['name'] = k o['value'] = v res.append(o) return HttpResponse(json.dumps({ - "res":res + "res": res })) + + def monitoring_report(request): - return render(request,'monitor/monitoring-report.html') + news = News.objects.filter(type='3').order_by('-date') + count = News.objects.filter(type='3').count() + return render(request, 'monitor/monitoring-report.html', {'news': news,'count':count}) def test(request): - return render(request,'monitor/test.html') + return render(request, 'monitor/test.html') + + def test_json(request): res = [] - with open('D:/2020/舆论监测平台/新媒体监测数据/平凉/Result_PL.csv',encoding='utf-8') as csvfile: + with open('D:/2020/舆论监测平台/新媒体监测数据/平凉/Result_PL.csv', encoding='utf-8') as csvfile: reader = csv.reader(csvfile) results = [] try: @@ -163,7 +188,7 @@ def test_json(request): if len(x) > 1 and x != '\r\n': c[x] += 1 for (k, v) in c.most_common(200): # 遍历输出高频词 - if all(map(lambda c:'\u4e00' <= c <= '\u9fa5',k)): + if all(map(lambda c: '\u4e00' <= c <= '\u9fa5', k)): o = dict() o['name'] = k o['value'] = v @@ -171,4 +196,3 @@ def test_json(request): return HttpResponse(json.dumps({ "res": res })) -