Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
da21bc172c
|
@ -0,0 +1,131 @@
|
||||||
|
{% extends 'polls/base.html' %}
|
||||||
|
{% block content%}
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<h4 class="title">市州合格率排行榜</h4>
|
||||||
|
<table class="table table-bordered table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>市</th>
|
||||||
|
<th>不合格</th>
|
||||||
|
<th>合格</th>
|
||||||
|
<th>数量</th>
|
||||||
|
<th>合格率</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">武威市</th>
|
||||||
|
<td>0</td>
|
||||||
|
<td>4</td>
|
||||||
|
<td>4</td>
|
||||||
|
<td>100.0%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">天水市</th>
|
||||||
|
<td>0</td>
|
||||||
|
<td>13</td>
|
||||||
|
<td>13</td>
|
||||||
|
<td>100.0%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">金昌市</th>
|
||||||
|
<td>2</td>
|
||||||
|
<td>53</td>
|
||||||
|
<td>55</td>
|
||||||
|
<td>96.4%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">嘉峪关市</th>
|
||||||
|
<td>3</td>
|
||||||
|
<td>44</td>
|
||||||
|
<td>47</td>
|
||||||
|
<td>93.6%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">甘肃省</th>
|
||||||
|
<td>20</td>
|
||||||
|
<td>132</td>
|
||||||
|
<td>152</td>
|
||||||
|
<td>86.8%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">兰州市</th>
|
||||||
|
<td>4</td>
|
||||||
|
<td>25</td>
|
||||||
|
<td>29</td>
|
||||||
|
<td>86.2%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">平凉市</th>
|
||||||
|
<td>5</td>
|
||||||
|
<td>29</td>
|
||||||
|
<td>34</td>
|
||||||
|
<td>85.3%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">庆阳市</th>
|
||||||
|
<td>27</td>
|
||||||
|
<td>137</td>
|
||||||
|
<td>164</td>
|
||||||
|
<td>83.5%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">白银市</th>
|
||||||
|
<td>3</td>
|
||||||
|
<td>15</td>
|
||||||
|
<td>18</td>
|
||||||
|
<td>83.3%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">临夏州</th>
|
||||||
|
<td>2</td>
|
||||||
|
<td>7</td>
|
||||||
|
<td>9</td>
|
||||||
|
<td>77.8%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">兰州新区</th>
|
||||||
|
<td>12</td>
|
||||||
|
<td>39</td>
|
||||||
|
<td>51</td>
|
||||||
|
<td>76.5%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">甘南州</th>
|
||||||
|
<td>2</td>
|
||||||
|
<td>6</td>
|
||||||
|
<td>8</td>
|
||||||
|
<td>75.0%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">定西市</th>
|
||||||
|
<td>3</td>
|
||||||
|
<td>8</td>
|
||||||
|
<td>11</td>
|
||||||
|
<td>72.7%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">酒泉市</th>
|
||||||
|
<td>3</td>
|
||||||
|
<td>6</td>
|
||||||
|
<td>9</td>
|
||||||
|
<td>66.7%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">陇南市</th>
|
||||||
|
<td>12</td>
|
||||||
|
<td>17</td>
|
||||||
|
<td>29</td>
|
||||||
|
<td>58.6%</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">张掖市</th>
|
||||||
|
<td>3</td>
|
||||||
|
<td>4</td>
|
||||||
|
<td>7</td>
|
||||||
|
<td>57.1%</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% endblock%}
|
|
@ -0,0 +1,167 @@
|
||||||
|
{% extends 'polls/base.html' %}
|
||||||
|
{% load static %}
|
||||||
|
{% block content%}
|
||||||
|
<div class="flex-container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div id="chart1" style="width: 100%%;height:400px;margin:20px 10px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock%}
|
||||||
|
{% block add_js %}
|
||||||
|
<script src="{% static 'polls/js/echarts.min.js' %}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
var myChart = echarts.init(document.getElementById('chart1'));
|
||||||
|
var posList = [
|
||||||
|
'left', 'right', 'top', 'bottom',
|
||||||
|
'inside',
|
||||||
|
'insideTop', 'insideLeft', 'insideRight', 'insideBottom',
|
||||||
|
'insideTopLeft', 'insideTopRight', 'insideBottomLeft', 'insideBottomRight'
|
||||||
|
];
|
||||||
|
|
||||||
|
myChart.configParameters = {
|
||||||
|
rotate: {
|
||||||
|
min: -90,
|
||||||
|
max: 90
|
||||||
|
},
|
||||||
|
align: {
|
||||||
|
options: {
|
||||||
|
left: 'left',
|
||||||
|
center: 'center',
|
||||||
|
right: 'right'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
verticalAlign: {
|
||||||
|
options: {
|
||||||
|
top: 'top',
|
||||||
|
middle: 'middle',
|
||||||
|
bottom: 'bottom'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
options: echarts.util.reduce(posList, function (map, pos) {
|
||||||
|
map[pos] = pos;
|
||||||
|
return map;
|
||||||
|
}, {})
|
||||||
|
},
|
||||||
|
distance: {
|
||||||
|
min: 0,
|
||||||
|
max: 100
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
myChart.config = {
|
||||||
|
rotate: 90,
|
||||||
|
align: 'left',
|
||||||
|
verticalAlign: 'middle',
|
||||||
|
position: 'insideBottom',
|
||||||
|
distance: 15,
|
||||||
|
onChange: function () {
|
||||||
|
var labelOption = {
|
||||||
|
normal: {
|
||||||
|
rotate: myChart.config.rotate,
|
||||||
|
align: myChart.config.align,
|
||||||
|
verticalAlign: myChart.config.verticalAlign,
|
||||||
|
position: myChart.config.position,
|
||||||
|
distance: myChart.config.distance
|
||||||
|
}
|
||||||
|
};
|
||||||
|
myChart.setOption({
|
||||||
|
series: [{
|
||||||
|
label: labelOption
|
||||||
|
}, {
|
||||||
|
label: labelOption
|
||||||
|
}, {
|
||||||
|
label: labelOption
|
||||||
|
}, {
|
||||||
|
label: labelOption
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var labelOption = {
|
||||||
|
show: true,
|
||||||
|
position: myChart.config.position,
|
||||||
|
distance: myChart.config.distance,
|
||||||
|
align: myChart.config.align,
|
||||||
|
verticalAlign: myChart.config.verticalAlign,
|
||||||
|
rotate: myChart.config.rotate,
|
||||||
|
formatter: '{c} {name|{a}}',
|
||||||
|
fontSize: 8,
|
||||||
|
rich: {
|
||||||
|
name: {
|
||||||
|
textBorderColor: '#fff'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var option = {
|
||||||
|
title: {
|
||||||
|
text: '逐月累计发文量',
|
||||||
|
subtextStyle: {
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
left: 'center'
|
||||||
|
},
|
||||||
|
color: ['#003366', '#006699', '#4cabce', '#e5323e', '#ccc'],
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
top: '10%',
|
||||||
|
data: ['微信', '微博', '头条', '抖音', '其它']
|
||||||
|
},
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
axisTick: {show: false},
|
||||||
|
data: ['6月','7月', '8月', '9月', '10月']
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '微信',
|
||||||
|
type: 'bar',
|
||||||
|
barGap: 0,
|
||||||
|
label: labelOption,
|
||||||
|
data: [320, 332, 301, 334, 390]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '微博',
|
||||||
|
type: 'bar',
|
||||||
|
label: labelOption,
|
||||||
|
data: [220, 182, 191, 234, 290]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '头条',
|
||||||
|
type: 'bar',
|
||||||
|
label: labelOption,
|
||||||
|
data: [150, 232, 201, 154, 190]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '抖音',
|
||||||
|
type: 'bar',
|
||||||
|
label: labelOption,
|
||||||
|
data: [98, 77, 101, 99, 40]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '其他',
|
||||||
|
type: 'bar',
|
||||||
|
label: labelOption,
|
||||||
|
data: [25, 32, 46, 20, 8]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
myChart.setOption(option);
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
|
@ -19,7 +19,8 @@ urlpatterns = [
|
||||||
path('notices/read/', views.read_notice, name='polls_read_notice'),
|
path('notices/read/', views.read_notice, name='polls_read_notice'),
|
||||||
path('notices/pass/', views.pass_notice, name='polls_pass_notice'),
|
path('notices/pass/', views.pass_notice, name='polls_pass_notice'),
|
||||||
path('notices/reject/', views.reject_notice, name='polls_reject_notice'),
|
path('notices/reject/', views.reject_notice, name='polls_reject_notice'),
|
||||||
path('notices/detail/<str:notice_id>/', views.detail_notice, name='polls_detail_notice'),
|
path('notices/detail/<str:notice_id>/',
|
||||||
|
views.detail_notice, name='polls_detail_notice'),
|
||||||
path('medias/create/', views.create_media, name='polls_add_media'),
|
path('medias/create/', views.create_media, name='polls_add_media'),
|
||||||
path('medias/update/', views.update_media, name='polls_update_media'),
|
path('medias/update/', views.update_media, name='polls_update_media'),
|
||||||
path('medias/list/', views.medias, name='polls_medias'),
|
path('medias/list/', views.medias, name='polls_medias'),
|
||||||
|
@ -33,6 +34,9 @@ urlpatterns = [
|
||||||
views.news_detail, name='polls_news_detail'),
|
views.news_detail, name='polls_news_detail'),
|
||||||
path('monitor/statistics/', views.monitor_statistics,
|
path('monitor/statistics/', views.monitor_statistics,
|
||||||
name='polls_monitor_statistics'),
|
name='polls_monitor_statistics'),
|
||||||
|
path('monitor/media/statistics/', views.media_statistics,
|
||||||
|
name='polls_media_statistics'),
|
||||||
|
path('monitor/city/ranking/', views.city_ranking, name='polls_city_ranking'),
|
||||||
path('monitor/result/', views.monitor_result,
|
path('monitor/result/', views.monitor_result,
|
||||||
name='polls_monitor_result'),
|
name='polls_monitor_result'),
|
||||||
path('tasks/list/', views.tasks, name='polls_tasks_list'),
|
path('tasks/list/', views.tasks, name='polls_tasks_list'),
|
||||||
|
@ -40,7 +44,10 @@ urlpatterns = [
|
||||||
path('tasks/create_test/', views.create_test_task,
|
path('tasks/create_test/', views.create_test_task,
|
||||||
name='polls_tasks_create_test'),
|
name='polls_tasks_create_test'),
|
||||||
path('groups/list/', views.groups, name='polls_groups_list'),
|
path('groups/list/', views.groups, name='polls_groups_list'),
|
||||||
|
path('groups/level/', views.is_level1_or_leve2, name='polls_groups_level'),
|
||||||
path('groups/test-room/', views.room, name='polls_group_test_room'),
|
path('groups/test-room/', views.room, name='polls_group_test_room'),
|
||||||
|
path('groups/manager/', views.group_manager, name='polls_groups_manager'),
|
||||||
|
path('groups/member/', views.group_member, name='polls_groups_member'),
|
||||||
path('compartments/list/', views.compartments,
|
path('compartments/list/', views.compartments,
|
||||||
name='polls_compartments_list'),
|
name='polls_compartments_list'),
|
||||||
path('organizations/list/', views.organizations,
|
path('organizations/list/', views.organizations,
|
||||||
|
|
|
@ -2,9 +2,9 @@ from .user import index, status_500, status_401, polls_login, send_code, registe
|
||||||
from .notice import notices, notice_top, read_notice, pass_notice, reject_notice, detail_notice
|
from .notice import notices, notice_top, read_notice, pass_notice, reject_notice, detail_notice
|
||||||
from .media import medias, my_medias, create_media, update_media, media_detail, delete_media
|
from .media import medias, my_medias, create_media, update_media, media_detail, delete_media
|
||||||
from .news import news_list, news_top, news_detail
|
from .news import news_list, news_top, news_detail
|
||||||
from .monitor import monitor_statistics, monitor_result
|
from .monitor import monitor_statistics, monitor_result, media_statistics, city_ranking
|
||||||
from .task import tasks, create_task, create_test_task
|
from .task import tasks, create_task, create_test_task
|
||||||
from .group import groups, room
|
from .group import groups, room, is_level1_or_leve2, group_member, group_manager
|
||||||
from .compartment import compartments
|
from .compartment import compartments
|
||||||
from .organizations import organizations, organization_level
|
from .organizations import organizations, organization_level
|
||||||
from .message import last_messages, send_text_message
|
from .message import last_messages, send_text_message
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -2,27 +2,39 @@ from django.shortcuts import render
|
||||||
from django.http import HttpResponse, JsonResponse
|
from django.http import HttpResponse, JsonResponse
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
import datetime
|
import datetime
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
from polls.decorators import polls_login_required
|
from polls.decorators import polls_login_required
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from dashboard.models import Group
|
from dashboard.models import Group, Userprofile
|
||||||
|
|
||||||
|
|
||||||
def room(request):
|
def room(request):
|
||||||
return render(request, 'polls/chat_text.html')
|
return render(request, 'polls/chat_text.html')
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
@polls_login_required
|
||||||
|
def is_level1_or_leve2(request):
|
||||||
|
if request.method == 'POST':
|
||||||
|
return HttpResponse(status=405)
|
||||||
|
user = request.user
|
||||||
|
profile = user.userprofile_set.first()
|
||||||
|
result = dict()
|
||||||
|
result['admin'] = profile.is_level1() or profile.is_level2()
|
||||||
|
return JsonResponse({'status': 'success', 'message': result}, safe=False)
|
||||||
|
|
||||||
|
|
||||||
@csrf_exempt
|
@csrf_exempt
|
||||||
@polls_login_required
|
@polls_login_required
|
||||||
def groups(request):
|
def groups(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
return HttpResponse(status=405)
|
return HttpResponse(status=405)
|
||||||
id = request.user.id
|
user_id = request.user.id
|
||||||
category = request.GET.get('category', '0')
|
category = request.GET.get('category')
|
||||||
if not category:
|
q = Group.objects.filter(Q(status=1), Q(
|
||||||
return JsonResponse({'status': 'error', 'message': '参数错误'})
|
group_user__user__id=user_id) | Q(group_admin__user__id=user_id))
|
||||||
|
groups = q.filter(classify=category) if category else q
|
||||||
groups = Group.objects.filter(status='1',classify=category)
|
|
||||||
results = []
|
results = []
|
||||||
for o in groups:
|
for o in groups:
|
||||||
result = dict()
|
result = dict()
|
||||||
|
@ -31,3 +43,45 @@ def groups(request):
|
||||||
result['image'] = request.build_absolute_uri(o.image.url)
|
result['image'] = request.build_absolute_uri(o.image.url)
|
||||||
results.append(result)
|
results.append(result)
|
||||||
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
@polls_login_required
|
||||||
|
def group_manager(request):
|
||||||
|
if request.method == 'POST':
|
||||||
|
return HttpResponse(status=405)
|
||||||
|
group_id = request.GET.get('group_id')
|
||||||
|
if not group_id:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '参数错误'})
|
||||||
|
managers = Userprofile.objects.filter(user__group_admin__group_id=group_id)
|
||||||
|
results = []
|
||||||
|
for m in managers:
|
||||||
|
result = dict()
|
||||||
|
result['id'] = m.user.id
|
||||||
|
result['name'] = m.name
|
||||||
|
result['thumbnail'] = request.build_absolute_uri(
|
||||||
|
m.image.url) if m.image else None
|
||||||
|
result['organization'] = m.organization.name
|
||||||
|
results.append(result)
|
||||||
|
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
@polls_login_required
|
||||||
|
def group_member(request):
|
||||||
|
if request.method == 'POST':
|
||||||
|
return HttpResponse(status=405)
|
||||||
|
group_id = request.GET.get('group_id')
|
||||||
|
if not group_id:
|
||||||
|
return JsonResponse({'status': 'error', 'message': '参数错误'})
|
||||||
|
managers = Userprofile.objects.filter(user__group_user__group_id=group_id)
|
||||||
|
results = []
|
||||||
|
for m in managers:
|
||||||
|
result = dict()
|
||||||
|
result['id'] = m.user.id
|
||||||
|
result['name'] = m.name
|
||||||
|
result['thumbnail'] = request.build_absolute_uri(
|
||||||
|
m.image.url) if m.image else None
|
||||||
|
result['organization'] = m.organization.name
|
||||||
|
results.append(result)
|
||||||
|
return JsonResponse({'status': 'success', 'message': results}, safe=False)
|
||||||
|
|
|
@ -52,33 +52,42 @@ def create_media(request):
|
||||||
attention = request.POST.get('attention', '')
|
attention = request.POST.get('attention', '')
|
||||||
remark = request.POST.get('remark', '')
|
remark = request.POST.get('remark', '')
|
||||||
model_name = ''
|
model_name = ''
|
||||||
|
status = 2 if o.directly == '省直部门' else 1
|
||||||
|
|
||||||
if category == 'weixin':
|
if category == 'weixin':
|
||||||
model_name = 'Weixin'
|
model_name = 'Weixin'
|
||||||
instance = Weixin(code=code, weixinid=media_id, alias=alias,
|
instance = Weixin(code=code, weixinid=media_id, alias=alias,
|
||||||
image=f, status=1, organization=o, attention=attention, remark=remark)
|
image=f, status=status, organization=o, attention=attention, remark=remark)
|
||||||
elif category == 'weibo':
|
elif category == 'weibo':
|
||||||
model_name = 'Weibo'
|
model_name = 'Weibo'
|
||||||
instance = Weibo(code=code, weiboid=media_id, alias=alias,
|
instance = Weibo(code=code, weiboid=media_id, alias=alias,
|
||||||
image=f, status=1, organization=o, attention=attention, remark=remark)
|
image=f, status=status, organization=o, attention=attention, remark=remark)
|
||||||
elif category == 'toutiao':
|
elif category == 'toutiao':
|
||||||
model_name = 'Toutiao'
|
model_name = 'Toutiao'
|
||||||
instance = Toutiao(code=code, toutiaoid=media_id, alias=alias,
|
instance = Toutiao(code=code, toutiaoid=media_id, alias=alias,
|
||||||
image=f, status=1, organization=o, attention=attention, remark=remark)
|
image=f, status=status, organization=o, attention=attention, remark=remark)
|
||||||
elif category == 'douyin':
|
elif category == 'douyin':
|
||||||
model_name = 'Douyin'
|
model_name = 'Douyin'
|
||||||
instance = Douyin(code=code, douyinid=media_id, alias=alias,
|
instance = Douyin(code=code, douyinid=media_id, alias=alias,
|
||||||
image=f, status=1, organization=o, attention=attention, remark=remark)
|
image=f, status=status, organization=o, attention=attention, remark=remark)
|
||||||
else:
|
else:
|
||||||
model_name = 'Qita'
|
model_name = 'Qita'
|
||||||
type = request.POST.get('type')
|
type = request.POST.get('type')
|
||||||
instance = Qita(code=code, qitaid=media_id, alias=alias,
|
instance = Qita(code=code, qitaid=media_id, alias=alias,
|
||||||
image=f, status=1, organization=o, attention=attention, remark=remark)
|
image=f, status=status, organization=o, attention=attention, remark=remark)
|
||||||
instance.save()
|
instance.save()
|
||||||
admins = Userprofile.level2_admin(instance.organization.cities)
|
if o.directly == '省直部门':
|
||||||
for a in admins:
|
admins = Userprofile.level1_admin()
|
||||||
content = '用户%s创建了新媒体,请审核' % (profile.name,)
|
for a in admins:
|
||||||
Notice.create_reply_notice(
|
content = '用户%s创建了新媒体,请审核' % (profile.name,)
|
||||||
a.user.id, content, 'dashboard', model_name, 'status', instance.id, '2', '0')
|
Notice.create_reply_notice(
|
||||||
|
a.user.id, content, 'dashboard', model_name, 'status', instance.id, '3', '0')
|
||||||
|
else:
|
||||||
|
admins = Userprofile.level2_admin(instance.organization.cities)
|
||||||
|
for a in admins:
|
||||||
|
content = '用户%s创建了新媒体,请审核' % (profile.name,)
|
||||||
|
Notice.create_reply_notice(
|
||||||
|
a.user.id, content, 'dashboard', model_name, 'status', instance.id, '2', '0')
|
||||||
|
|
||||||
return JsonResponse({'status': 'success'})
|
return JsonResponse({'status': 'success'})
|
||||||
|
|
||||||
|
@ -212,13 +221,23 @@ def delete_media(request):
|
||||||
model_name = 'Qita'
|
model_name = 'Qita'
|
||||||
instance = Qita.objects.get(pk=media_id)
|
instance = Qita.objects.get(pk=media_id)
|
||||||
result['media_id'] = instance.qitaid
|
result['media_id'] = instance.qitaid
|
||||||
instance.status = 4
|
|
||||||
instance.save()
|
if o.directly == '省直部门':
|
||||||
admins = Userprofile.level2_admin(instance.organization.cities)
|
instance.status = 5
|
||||||
for a in admins:
|
instance.save()
|
||||||
content = '用户%s申请注销新媒体,请审核' % (profile.name,)
|
managers = Userprofile.level1_admin()
|
||||||
Notice.create_reply_notice(
|
for a in managers:
|
||||||
a.user.id, content, 'dashboard', model_name, 'status', instance.id, '5', '3')
|
content = '用户%s申请注销新媒体,请审核' % (profile.name,)
|
||||||
|
Notice.create_reply_notice(
|
||||||
|
a.user.id, content, 'dashboard', model_name, 'status', instance.id, '0', '3')
|
||||||
|
else:
|
||||||
|
instance.status = 4
|
||||||
|
instance.save()
|
||||||
|
managers = Userprofile.level2_admin(instance.organization.cities)
|
||||||
|
for a in managers:
|
||||||
|
content = '用户%s申请注销新媒体,请审核' % (profile.name,)
|
||||||
|
Notice.create_reply_notice(
|
||||||
|
a.user.id, content, 'dashboard', model_name, 'status', instance.id, '5', '3')
|
||||||
|
|
||||||
admins = []
|
admins = []
|
||||||
for admin in instance.organization.userprofile_set.all():
|
for admin in instance.organization.userprofile_set.all():
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from dashboard.models import Douyin, NewMedia, Qita, Toutiao, Weibo, Weixin
|
from dashboard.models import Douyin, NewMedia, Qita, Toutiao, Weibo, Weixin
|
||||||
from django.db.models import Count, Sum
|
from django.db.models import Count, Sum
|
||||||
|
|
||||||
|
@ -22,6 +24,7 @@ COMPARTMENTS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
def monitor_statistics(request):
|
def monitor_statistics(request):
|
||||||
wbc = Weibo.objects.count()
|
wbc = Weibo.objects.count()
|
||||||
wxc = Weixin.objects.count()
|
wxc = Weixin.objects.count()
|
||||||
|
@ -109,5 +112,15 @@ def monitor_statistics(request):
|
||||||
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'chart3_data': chart3_data})
|
return render(request, 'polls/monitor_statistics.html', {'chart1_data': chart1_data, 'total': total, 'chart2_data': chart2_data, 'chart3_data': chart3_data})
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
def media_statistics(request):
|
||||||
|
return render(request, 'polls/media_statistics.html')
|
||||||
|
|
||||||
|
|
||||||
|
@csrf_exempt
|
||||||
|
def city_ranking(request):
|
||||||
|
return render(request, 'polls/city_ranking.html')
|
||||||
|
|
||||||
|
|
||||||
def monitor_result(request):
|
def monitor_result(request):
|
||||||
return render(request, 'polls/monitor_result.html')
|
return render(request, 'polls/monitor_result.html')
|
||||||
|
|
Loading…
Reference in New Issue