diff --git a/dashboard/templates/dashboard/base/header.html b/dashboard/templates/dashboard/base/header.html index 10986fd..d4f6c80 100644 --- a/dashboard/templates/dashboard/base/header.html +++ b/dashboard/templates/dashboard/base/header.html @@ -1,8 +1,7 @@ {% load static %}
-
- -
+
+
@@ -43,9 +41,10 @@
{#

矩阵列表

#}
diff --git a/management/templates/management/group-management-user.html b/management/templates/management/group-management-user.html index f540d44..33b73ae 100644 --- a/management/templates/management/group-management-user.html +++ b/management/templates/management/group-management-user.html @@ -43,9 +43,10 @@
{#

矩阵列表

#}
diff --git a/management/templates/management/newmedia-management-edit-douyin.html b/management/templates/management/newmedia-management-edit-douyin.html index 3b10fce..4cfabed 100644 --- a/management/templates/management/newmedia-management-edit-douyin.html +++ b/management/templates/management/newmedia-management-edit-douyin.html @@ -23,6 +23,7 @@

抖音列表

+

抖音总计:{{ douyin_count }}

diff --git a/management/templates/management/newmedia-management-edit-qita.html b/management/templates/management/newmedia-management-edit-qita.html index 27e4612..41887b4 100644 --- a/management/templates/management/newmedia-management-edit-qita.html +++ b/management/templates/management/newmedia-management-edit-qita.html @@ -23,6 +23,7 @@

其他新媒体列表

+

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

diff --git a/management/templates/management/newmedia-management-edit-toutiao.html b/management/templates/management/newmedia-management-edit-toutiao.html index ae59001..cbe7098 100644 --- a/management/templates/management/newmedia-management-edit-toutiao.html +++ b/management/templates/management/newmedia-management-edit-toutiao.html @@ -23,6 +23,7 @@

头条列表

+

头条总计:{{ toutiao_count }}

diff --git a/management/templates/management/newmedia-management-edit-weibo.html b/management/templates/management/newmedia-management-edit-weibo.html index e11023b..02761f9 100644 --- a/management/templates/management/newmedia-management-edit-weibo.html +++ b/management/templates/management/newmedia-management-edit-weibo.html @@ -23,6 +23,7 @@

微博列表

+

微博总计:{{ weibo_count }}

diff --git a/management/templates/management/newmedia-management-edit-weixin.html b/management/templates/management/newmedia-management-edit-weixin.html index bc14602..56dd162 100644 --- a/management/templates/management/newmedia-management-edit-weixin.html +++ b/management/templates/management/newmedia-management-edit-weixin.html @@ -23,6 +23,7 @@

微信公众号列表

+

微信总计:{{ weixin_count }}

diff --git a/management/templates/management/news-management.html b/management/templates/management/news-management.html index 632597f..c26f5b6 100644 --- a/management/templates/management/news-management.html +++ b/management/templates/management/news-management.html @@ -42,6 +42,7 @@

新闻列表

+

新闻总计:{{ news_count }}

{#
#} {# #} {# #} diff --git a/management/templates/management/organization-management.html b/management/templates/management/organization-management.html index 2fb99c0..5dad58e 100644 --- a/management/templates/management/organization-management.html +++ b/management/templates/management/organization-management.html @@ -42,6 +42,7 @@

单位列表

+

单位总计:{{ organization_count }}

{#
#} {# #} {# #} diff --git a/management/templates/management/user-management.html b/management/templates/management/user-management.html index 20c91d3..2a03a4e 100644 --- a/management/templates/management/user-management.html +++ b/management/templates/management/user-management.html @@ -23,6 +23,7 @@

成员列表

+

成员总计:{{ user_count }}

diff --git a/management/views.py b/management/views.py index 4775d6c..698276e 100644 --- a/management/views.py +++ b/management/views.py @@ -14,6 +14,7 @@ from dashboard.models import Userprofile, Group, Organization, Level, Organizati @login_required def user_management(request): + user_count = User.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) level = o.level.level @@ -90,7 +91,7 @@ def user_management(request): userallinfo.append(o) print(userallinfo) return render(request, 'management/user-management.html', - {'userallinfo': userallinfo, 'userpaginator': userpaginator}) + {'userallinfo': userallinfo, 'userpaginator': userpaginator,'user_count':user_count}) @login_required @@ -150,7 +151,9 @@ def user_update(request, pk): @login_required def group_management_init(request): + user = request.user + init_count = Group.objects.filter(user_id=user.id).count() # 创建的矩阵 group_initer = Group.objects.filter(user_id=user.id).order_by('-created') print(group_initer) @@ -173,13 +176,14 @@ def group_management_init(request): o1['user_count'] = Group_user.objects.filter(group_id=r_g_i.id).count() o1['status'] = r_g_i.status res_g_i.append(o1) - return render(request, 'management/group-management-init.html', {'group': group, 'res_g_i': res_g_i}) + return render(request, 'management/group-management-init.html', {'group': group, 'res_g_i': res_g_i,'init_count':init_count}) @login_required def group_management_admin(request): # 管理的矩阵 user = request.user + admin_count = Group_admin.objects.filter(user_id=user.id).count() group_admin_list = [] for g_a in Group_admin.objects.filter(user_id=user.id).order_by('-created'): group_admin = Group.objects.get(id=g_a.group_id) @@ -203,13 +207,14 @@ def group_management_admin(request): o2['user_count'] = Group_user.objects.filter(group_id=r_g_a.id).count() o2['status'] = r_g_a.status res_g_a.append(o2) - return render(request, 'management/group-management-admin.html', {'group': group, 'res_g_a': res_g_a}) + return render(request, 'management/group-management-admin.html', {'group': group, 'res_g_a': res_g_a,'admin_count':admin_count}) @login_required def group_management_user(request): # 加入的矩阵 user = request.user + user_count = Group_user.objects.filter(user_id=user.id).count() group_user_list = [] for g_u in Group_user.objects.filter(user_id=user.id).order_by('-created'): group_user = Group.objects.get(id=g_u.group_id) @@ -233,7 +238,7 @@ def group_management_user(request): o3['user_count'] = Group_user.objects.filter(group_id=r_g_u.id).count() o3['status'] = r_g_u.status res_g_u.append(o3) - return render(request, 'management/group-management-user.html', {'group': group, 'res_g_u': res_g_u}) + return render(request, 'management/group-management-user.html', {'group': group, 'res_g_u': res_g_u,'user_count':user_count}) @login_required @@ -518,6 +523,7 @@ def group_delete(request, pk): @login_required def organization_management(request): + organization_count = Organization.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) print(o) @@ -577,7 +583,7 @@ def organization_management(request): organization_id=i.id).count() res.append(o) - return render(request, 'management/organization-management.html', {"organization": organization, 'res': res}) + return render(request, 'management/organization-management.html', {"organization": organization, 'res': res,'organization_count':organization_count}) @login_required @@ -942,6 +948,7 @@ def newmedia_management_edit_menu(request): @login_required def newmedia_management_edit_weixin(request): + weixin_count = Weixin.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) level = o.level.level @@ -1006,11 +1013,12 @@ def newmedia_management_edit_weixin(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-weixin.html', {'weixin': weixin, 'res': res}) + return render(request, 'management/newmedia-management-edit-weixin.html', {'weixin': weixin, 'res': res,'weixin_count':weixin_count}) @login_required def newmedia_management_edit_weibo(request): + weibo_count = Weibo.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) level = o.level.level @@ -1073,11 +1081,12 @@ def newmedia_management_edit_weibo(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-weibo.html', {'weibo': weibo, 'res': res}) + return render(request, 'management/newmedia-management-edit-weibo.html', {'weibo': weibo, 'res': res,'weibo_count':weibo_count}) @login_required def newmedia_management_edit_toutiao(request): + toutiao_count = Toutiao.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) level = o.level.level @@ -1141,11 +1150,12 @@ def newmedia_management_edit_toutiao(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-toutiao.html', {'toutiao': toutiao, 'res': res}) + return render(request, 'management/newmedia-management-edit-toutiao.html', {'toutiao': toutiao, 'res': res,'toutiao_count':toutiao_count}) @login_required def newmedia_management_edit_douyin(request): + douyin_count = Douyin.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) level = o.level.level @@ -1209,11 +1219,12 @@ def newmedia_management_edit_douyin(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-douyin.html', {'douyin': douyin, 'res': res}) + return render(request, 'management/newmedia-management-edit-douyin.html', {'douyin': douyin, 'res': res,'douyin_count':douyin_count}) @login_required def newmedia_management_edit_qita(request): + qita_count = Qita.objects.all().count() user = request.user o = Organization.objects.get(userprofile__user_id=user.id) level = o.level.level @@ -1276,7 +1287,7 @@ def newmedia_management_edit_qita(request): o['administrativedivision'] = str(Area_code_2020.objects.get(code=w.organization.province).name) o['status'] = w.status res.append(o) - return render(request, 'management/newmedia-management-edit-qita.html', {'qita': qita, 'res': res}) + return render(request, 'management/newmedia-management-edit-qita.html', {'qita': qita, 'res': res,'qita_count':qita_count}) @login_required @@ -1577,6 +1588,7 @@ def newmedia_management_delete_qita(request, pk): @login_required def new_management(request): + news_count = News.objects.all().count() news = News.objects.all() paginator = Paginator(news, 6) page = int(request.GET.get('page', 1)) @@ -1608,7 +1620,7 @@ def new_management(request): elif n.type == '6': o['type'] = '重点新闻' news_list.append(o) - return render(request, 'management/news-management.html', {'news': news_list, 'new': news}) + return render(request, 'management/news-management.html', {'news': news_list, 'new': news,'news_count':news_count}) @login_required diff --git a/monitor/views.py b/monitor/views.py index 1110e22..d1e6253 100644 --- a/monitor/views.py +++ b/monitor/views.py @@ -129,11 +129,13 @@ def comment_on_interactive_monitoring_json(request): c[x] += 1 res = [] for (k, v) in c.most_common(200): # 遍历输出高频词 - print('%s%s %s %d' % (' ' * (5 - len(k)), k, '*', v)) - o = dict() - o['name'] = k - o['value'] = v - res.append(o) + # print('%s%s %s %d' % (' ' * (5 - len(k)), k, '*', v)) + #剔除不是汉字的值 + 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 }))