This commit is contained in:
Bob 2020-09-29 10:48:26 +08:00
parent 7f776a7ce6
commit 7c25ed8b69
12 changed files with 200 additions and 36 deletions

View File

@ -112,6 +112,7 @@ class Organization(models.Model):
level = models.ForeignKey( level = models.ForeignKey(
Level, on_delete=models.CASCADE, null=True, blank=True) Level, on_delete=models.CASCADE, null=True, blank=True)
directly = models.CharField('单位类型', max_length=256, null=True, blank=True) directly = models.CharField('单位类型', max_length=256, null=True, blank=True)
status = models.CharField('状态',max_length=256,null=True,blank=True)
created = models.DateTimeField('创建时间', auto_now_add=True) created = models.DateTimeField('创建时间', auto_now_add=True)
updated = models.DateTimeField('更新时间', auto_now=True) updated = models.DateTimeField('更新时间', auto_now=True)

View File

@ -27,7 +27,7 @@ def index(request):
toutiao_count = Toutiao.objects.all().count() toutiao_count = Toutiao.objects.all().count()
qita_count = Qita.objects.all().count() qita_count = Qita.objects.all().count()
douyin_count = Douyin.objects.all().count() douyin_count = Douyin.objects.all().count()
organization_count = Organization.objects.all().count() organization_count = Organization.objects.filter(status='1').count()
# year = datetime.datetime.now().year # year = datetime.datetime.now().year
# month = datetime.datetime.now().month # month = datetime.datetime.now().month
# month = datetime.datetime.now().month # month = datetime.datetime.now().month
@ -95,7 +95,7 @@ def register(request):
sex = None sex = None
hash_key = CaptchaStore.generate_key() hash_key = CaptchaStore.generate_key()
image_url = captcha_image_url(hash_key) image_url = captcha_image_url(hash_key)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
if request.method == 'POST': if request.method == 'POST':
if not request.POST.get('organization'): if not request.POST.get('organization'):
messages.error(request, '请选择单位') messages.error(request, '请选择单位')

View File

@ -107,6 +107,16 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="form-label" for="classify">矩阵分类</label>
<div class="controls">
<select class="form-control" name="classify">
{% for g in g_c_c_res %}
<option value="{{ g }}">{{ g }}</option>
{% endfor %}
</select>
</div>
</div>
<button type="submit" class="btn btn-success">点击创建</button> <button type="submit" class="btn btn-success">点击创建</button>
</form> </form>

View File

@ -108,6 +108,17 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="form-label" for="classify">矩阵分类</label>
<div class="controls">
<select class="form-control" name="classify">
<option value="{{ group.classify }}">{{ group.classify }}</option>
{% for g in g_c_c_res %}
<option value="{{ g }}">{{ g }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="form-label" for="stauts">管理员</label> <label class="form-label" for="stauts">管理员</label>
<div class="controls" style="margin-left: 5%"> <div class="controls" style="margin-left: 5%">

View File

@ -65,7 +65,7 @@ def user_delete(request, pk):
def user_update(request, pk): def user_update(request, pk):
user = User.objects.get(id=pk) user = User.objects.get(id=pk)
userprofile = Userprofile.objects.get(user_id=user.id) userprofile = Userprofile.objects.get(user_id=user.id)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
if request.method == 'POST': if request.method == 'POST':
organization_id = request.POST.get('organization') organization_id = request.POST.get('organization')
name = request.POST.get('name') name = request.POST.get('name')
@ -197,6 +197,10 @@ def group_update(request, pk):
group_status_choices_list = [] group_status_choices_list = []
for g in range(2): for g in range(2):
group_status_choices_list.append(g) group_status_choices_list.append(g)
GROUP_CLASSIFY_CHOICES = Group.GROUP_CLASSIFY_CHOICES
g_c_c_res = []
for g_c_c in GROUP_CLASSIFY_CHOICES:
g_c_c_res.append(list(g_c_c)[1])
group_type = Group_type.objects.all() group_type = Group_type.objects.all()
group_admin = Group_admin.objects.filter(group_id=pk) group_admin = Group_admin.objects.filter(group_id=pk)
print(pk) print(pk)
@ -230,6 +234,7 @@ def group_update(request, pk):
type = request.POST.get('type') type = request.POST.get('type')
status = request.POST.get('status') status = request.POST.get('status')
province = request.POST.get('province') province = request.POST.get('province')
classify = request.POST.get('classify')
print(str(province) + "66666666666666666666666666") print(str(province) + "66666666666666666666666666")
if province != '' and province.isdigit(): if province != '' and province.isdigit():
province_r = Area_code_2020.objects.get(code=province).name province_r = Area_code_2020.objects.get(code=province).name
@ -258,7 +263,7 @@ def group_update(request, pk):
if image is not None: if image is not None:
Group.objects.filter(id=pk).update(name=name, presentation=presentation, type_id=type, status=status, Group.objects.filter(id=pk).update(name=name, presentation=presentation, type_id=type, status=status,
province=province_r, cities=city_r, district=district_r, town=town_r, province=province_r, cities=city_r, district=district_r, town=town_r,
village=village_r) village=village_r,classify=classify)
g = Group.objects.get(id=pk) g = Group.objects.get(id=pk)
g.image = image g.image = image
g.save() g.save()
@ -267,12 +272,12 @@ def group_update(request, pk):
else: else:
Group.objects.filter(id=pk).update(name=name, presentation=presentation, type_id=type, status=status, Group.objects.filter(id=pk).update(name=name, presentation=presentation, type_id=type, status=status,
province=province_r, cities=city_r, district=district_r, town=town_r, province=province_r, cities=city_r, district=district_r, town=town_r,
village=village_r) village=village_r,classify=classify)
messages.success(request, '修改成功') messages.success(request, '修改成功')
return HttpResponseRedirect('/management/group/management/init/') return HttpResponseRedirect('/management/group/management/init/')
return render(request, 'management/group-management-update.html', return render(request, 'management/group-management-update.html',
{'group': group, 'group_status_choices_list': group_status_choices_list, 'group_type': group_type, {'group': group, 'group_status_choices_list': group_status_choices_list, 'group_type': group_type,
'g_a_list': g_a_list, 'g_u_list': g_u_list}) 'g_a_list': g_a_list, 'g_u_list': g_u_list,'g_c_c_res':g_c_c_res})
def group_create(request): def group_create(request):
@ -281,6 +286,10 @@ def group_create(request):
for g in range(2): for g in range(2):
group_status_choices_list.append(g) group_status_choices_list.append(g)
group_type = Group_type.objects.all() group_type = Group_type.objects.all()
GROUP_CLASSIFY_CHOICES = Group.GROUP_CLASSIFY_CHOICES
g_c_c_res = []
for g_c_c in GROUP_CLASSIFY_CHOICES:
g_c_c_res.append(list(g_c_c)[1])
if request.method == 'POST': if request.method == 'POST':
name = request.POST.get('name') name = request.POST.get('name')
presentation = request.POST.get('presentation') presentation = request.POST.get('presentation')
@ -288,6 +297,7 @@ def group_create(request):
type = request.POST.get('type') type = request.POST.get('type')
status = request.POST.get('status') status = request.POST.get('status')
province = request.POST.get('province') province = request.POST.get('province')
classify = request.POST.get('classify')
if province != '': if province != '':
province_r = Area_code_2020.objects.get(code=province).name province_r = Area_code_2020.objects.get(code=province).name
else: else:
@ -316,7 +326,7 @@ def group_create(request):
print(name, presentation, image, type, status, province, city, district, town, village) print(name, presentation, image, type, status, province, city, district, town, village)
if name is not None: if name is not None:
group = Group(name=name, presentation=presentation, image=image, type_id=type, status=status, group = Group(name=name, presentation=presentation, image=image, type_id=type, status=status,
province=province_r, cities=city_r, district=district_r, town=town_r, village=village_r,user_id=user.id) province=province_r, cities=city_r, district=district_r, town=town_r, village=village_r,user_id=user.id,classify=classify)
group.save() group.save()
messages.success(request, '添加成功') messages.success(request, '添加成功')
return render(request,'management/add-group-admin-and-user.html',{'group':group}) return render(request,'management/add-group-admin-and-user.html',{'group':group})
@ -324,7 +334,7 @@ def group_create(request):
messages.error(request, '矩阵名不能为空') messages.error(request, '矩阵名不能为空')
# return HttpResponseRedirect('/management/group/management/') # return HttpResponseRedirect('/management/group/management/')
return render(request, 'management/group-management-create.html', return render(request, 'management/group-management-create.html',
{'group_status_choices_list': group_status_choices_list, 'group_type': group_type}) {'group_status_choices_list': group_status_choices_list, 'group_type': group_type,'g_c_c_res':g_c_c_res})
def group_admin_create(request, pk): def group_admin_create(request, pk):
@ -525,7 +535,7 @@ def organization_create(request):
if name is not None: if name is not None:
organization = Organization(name=name, image=image, organizationtype_id=organizationtype, organization = Organization(name=name, image=image, organizationtype_id=organizationtype,
province=province, cities=city, district=district, town=town, province=province, cities=city, district=district, town=town,
village=village,level_id=level_id) village=village,level_id=level_id,status='0')
organization.save() organization.save()
messages.success(request, '添加成功') messages.success(request, '添加成功')
else: else:
@ -542,7 +552,7 @@ def newmedia_management_create_weixin(request):
weixin_status_choices_list = [] weixin_status_choices_list = []
for w in range(2): for w in range(2):
weixin_status_choices_list.append(w) weixin_status_choices_list.append(w)
organization = Organization.objects.all().order_by('-name') organization = Organization.objects.filter(status='1').order_by('-name')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
weixinid = request.POST.get('weixinid') weixinid = request.POST.get('weixinid')
@ -580,7 +590,7 @@ def newmedia_management_create_weibo(request):
weibo_status_choices_list = [] weibo_status_choices_list = []
for w in range(2): for w in range(2):
weibo_status_choices_list.append(w) weibo_status_choices_list.append(w)
organization = Organization.objects.all().order_by('-name') organization = Organization.objects.filter(status='1').order_by('-name')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
weiboid = request.POST.get('weiboid') weiboid = request.POST.get('weiboid')
@ -619,7 +629,7 @@ def newmedia_management_create_toutiao(request):
toutiao_status_choices_list = [] toutiao_status_choices_list = []
for w in range(2): for w in range(2):
toutiao_status_choices_list.append(w) toutiao_status_choices_list.append(w)
organization = Organization.objects.all().order_by('-name') organization = Organization.objects.filter(status='1').order_by('-name')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
toutiaoid = request.POST.get('toutiaoid') toutiaoid = request.POST.get('toutiaoid')
@ -658,7 +668,7 @@ def newmedia_management_create_douyin(request):
for w in range(2): for w in range(2):
douyin_status_choices_list.append(w) douyin_status_choices_list.append(w)
print(douyin_status_choices_list) print(douyin_status_choices_list)
organization = Organization.objects.all().order_by('-name') organization = Organization.objects.filter(status='1').order_by('-name')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
douyinid = request.POST.get('douyinid') douyinid = request.POST.get('douyinid')
@ -696,7 +706,7 @@ def newmedia_management_create_qita(request):
qita_status_choices_list = [] qita_status_choices_list = []
for w in range(2): for w in range(2):
qita_status_choices_list.append(w) qita_status_choices_list.append(w)
organization = Organization.objects.all().order_by('-name') organization = Organization.objects.filter(status='1').order_by('-name')
if request.method == 'POST': if request.method == 'POST':
type = request.POST.get('type') type = request.POST.get('type')
name = request.POST.get('name') name = request.POST.get('name')
@ -1045,7 +1055,7 @@ def newmedia_management_update_weixin(request, pk):
for w in range(2): for w in range(2):
weixin_status_choices_list.append(w) weixin_status_choices_list.append(w)
weixin = Weixin.objects.get(id=pk) weixin = Weixin.objects.get(id=pk)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
weixinid = request.POST.get('weixinid') weixinid = request.POST.get('weixinid')
@ -1087,7 +1097,7 @@ def newmedia_management_update_weibo(request, pk):
for w in range(2): for w in range(2):
weibo_status_choices_list.append(w) weibo_status_choices_list.append(w)
weibo = Weibo.objects.get(id=pk) weibo = Weibo.objects.get(id=pk)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
weiboid = request.POST.get('weiboid') weiboid = request.POST.get('weiboid')
@ -1129,7 +1139,7 @@ def newmedia_management_update_toutiao(request, pk):
for w in range(2): for w in range(2):
toutiao_status_choices_list.append(w) toutiao_status_choices_list.append(w)
toutiao = Toutiao.objects.get(id=pk) toutiao = Toutiao.objects.get(id=pk)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
toutiaoid = request.POST.get('toutiaoid') toutiaoid = request.POST.get('toutiaoid')
@ -1170,7 +1180,7 @@ def newmedia_management_update_douyin(request, pk):
for w in range(2): for w in range(2):
douyin_status_choices_list.append(w) douyin_status_choices_list.append(w)
douyin = Douyin.objects.get(id=pk) douyin = Douyin.objects.get(id=pk)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
if request.method == 'POST': if request.method == 'POST':
code = request.POST.get('code') code = request.POST.get('code')
douyinid = request.POST.get('douyinid') douyinid = request.POST.get('douyinid')
@ -1209,7 +1219,7 @@ def newmedia_management_update_qita(request, pk):
qita_status_choices_list = [] qita_status_choices_list = []
for w in range(2): for w in range(2):
qita_status_choices_list.append(w) qita_status_choices_list.append(w)
organization = Organization.objects.all() organization = Organization.objects.filter(status='1')
qita = Qita.objects.get(id=pk) qita = Qita.objects.get(id=pk)
if request.method == 'POST': if request.method == 'POST':
type = request.POST.get('type') type = request.POST.get('type')

View File

@ -0,0 +1,110 @@
{% extends 'dashboard/base/base.html' %}
{% load static %}
{% block content %}
<body class=" ">
<!-- START TOPBAR -->
<!-- START CONTAINER -->
<div class="page-container row-fluid">
<div class="page-sidebar ">
{% include 'dashboard/base/left.html' %}
</div>
<section id="main-content" class=" ">
<section class="wrapper" style='margin-top:60px;display:inline-block;width:100%;padding:15px 0 0 15px;'>
{% if messages %}
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
{% for message in messages %}
{{ message }}.<br/>
{% endfor %}
</div>
{% endif %}
</section>
<div class="chatapi-windows "></div>
<div class="panel panel-default">
<div class="panel-heading">
<ul class="nav nav-pills">
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-douyin' %}">抖音</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul>
</div>
<div class="panel-body">
<div class="panel panel-default">
<div class="panel-heading">抖音热点</div>
<div class="panel-body">
<div class="col-md-8" style="margin-top: 10px">
<div class="col-md-8">
公众号
<select id="basicSelect">
<option value="toutiao_all">全部</option>
{% for t in douyin %}
<option value="{{ t.id }}">{{ t.code }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-4">
分组
<select id="basicSelect">
<option value="group_all">全部</option>
{% for g in group %}
<option value="{{ g.id }}">{{ g.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="col-md-4">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div><!-- /input-group -->
</div>
</div>
<div class="panel panel-default">
<!-- Default panel contents -->
<table class="table table-hover" style="font-size: 14px">
<thead>
<tr>
<th style="text-align: center">抖音号</th>
<th style="text-align: center">封面</th>
<th style="text-align: center">总发文量</th>
<th style="text-align: center">监测时间内发文量</th>
<th style="text-align: center">评论数</th>
<th style="text-align: center">作者回复数</th>
<th style="text-align: center">最近发文日期</th>
</tr>
</thead>
<tbody>
{% for r in res %}
<tr>
<td style="vertical-align: middle;text-align: center">{{ r.code }}</td>
<td style="vertical-align: middle;text-align: center"><img src="{{ r.image.url }}" style="width: 40px;height: 40px;"
class="img-circle"></td>
<td style="vertical-align: middle;text-align: center">{{ r.count }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.count_jc }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.comment }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.reply }}</td>
<td style="vertical-align: middle;text-align: center">{{ r.date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
{% endblock %}

View File

@ -34,6 +34,7 @@
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a>
</li> </li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-douyin' %}">抖音</a></li>
<li role="presentation" class="active"><a <li role="presentation" class="active"><a
href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li> href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul> </ul>

View File

@ -32,6 +32,7 @@
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li> <li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-douyin' %}">抖音</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul> </ul>
</div> </div>

View File

@ -32,6 +32,7 @@
<li role="presentation" ><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li> <li role="presentation" ><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li> <li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-douyin' %}">抖音</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul> </ul>
</div> </div>

View File

@ -32,6 +32,7 @@
<li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li> <li role="presentation" class="active"><a href="{% url 'monitor-new-media-public-opinion-weixin' %}">微信</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-toutiao' %}">头条</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-weibo' %}">微博</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-douyin' %}">抖音</a></li>
<li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li> <li role="presentation"><a href="{% url 'monitor-new-media-public-opinion-qita' %}">其他</a></li>
</ul> </ul>
</div> </div>

View File

@ -1,11 +1,12 @@
from django.urls import path from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
#新媒体舆情 #新媒体舆情
path('new/media/public/opinion/weixin/',views.new_media_public_opinion_weixin,name='monitor-new-media-public-opinion-weixin'), path('new/media/public/opinion/weixin/',views.new_media_public_opinion_weixin,name='monitor-new-media-public-opinion-weixin'),
path('new/media/public/opinion/weibo/',views.new_media_public_opinion_weibo,name='monitor-new-media-public-opinion-weibo'), path('new/media/public/opinion/weibo/',views.new_media_public_opinion_weibo,name='monitor-new-media-public-opinion-weibo'),
path('new/media/public/opinion/toutiao/',views.new_media_public_opinion_toutiao,name='monitor-new-media-public-opinion-toutiao'), path('new/media/public/opinion/toutiao/',views.new_media_public_opinion_toutiao,name='monitor-new-media-public-opinion-toutiao'),
path('new/media/public/opinion/qita/',views.new_media_public_opinion_qita,name='monitor-new-media-public-opinion-qita'), path('new/media/public/opinion/douyin/',views.new_media_public_opinion_douyin,name='monitor-new-media-public-opinion-douyin'),
] path('new/media/public/opinion/qita/',views.new_media_public_opinion_qita,name='monitor-new-media-public-opinion-qita'),
]

View File

@ -1,13 +1,14 @@
from django.shortcuts import render from django.shortcuts import render
# Create your views here. # Create your views here.
from dashboard.models import Weixin, Weixin_data, Toutiao_data, Weibo_data, Qita_jc, Group, Toutiao, Weibo, Qita 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): def new_media_public_opinion_weixin(request):
weixin = Weixin.objects.all() weixin = Weixin.objects.all()
group = Group.objects.all() group = Group.objects.all()
weixin_data = Weixin_data.objects.all() weixin_data = Weixin_data.objects.all().order_by('-comment')
res = [] res = []
for w in weixin_data: for w in weixin_data:
o = dict() o = dict()
@ -26,7 +27,7 @@ def new_media_public_opinion_weixin(request):
def new_media_public_opinion_toutiao(request): def new_media_public_opinion_toutiao(request):
toutiao = Toutiao.objects.all() toutiao = Toutiao.objects.all()
group = Group.objects.all() group = Group.objects.all()
toutiao_data = Toutiao_data.objects.all() toutiao_data = Toutiao_data.objects.all().order_by('-count')
res = [] res = []
for t in toutiao_data: for t in toutiao_data:
o = dict() o = dict()
@ -42,11 +43,27 @@ def new_media_public_opinion_toutiao(request):
o['day'] = t.day o['day'] = t.day
res.append(o) 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()
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): def new_media_public_opinion_weibo(request):
weibo = Weibo.objects.all() weibo = Weibo.objects.all()
group = Group.objects.all() group = Group.objects.all()
weibo_data = Weibo_data.objects.all() weibo_data = Weibo_data.objects.all().order_by('-like')
res = [] res = []
for w in weibo_data: for w in weibo_data:
o = dict() o = dict()
@ -66,7 +83,7 @@ def new_media_public_opinion_weibo(request):
def new_media_public_opinion_qita(request): def new_media_public_opinion_qita(request):
qita = Qita.objects.all() qita = Qita.objects.all()
group = Group.objects.all() group = Group.objects.all()
qita_jc = Qita_jc.objects.all() qita_jc = Qita_jc.objects.all().order_by('-comment')
res = [] res = []
for q in qita_jc: for q in qita_jc:
o = dict() o = dict()