add monitor unqualified

This commit is contained in:
baoliang 2021-04-20 10:52:27 +08:00
parent 82c64018a4
commit 6faa98a88b
10 changed files with 79 additions and 6 deletions

View File

@ -0,0 +1,26 @@
{% extends 'polls/base.html' %} {% load static %} {% block content%}
<div class="flex-container">
<div class="row">
<div class="col-xs-12">
<div
style="
margin: 10px;
border-left: 4px solid #2e94fa;
font-size: 18px;
padding: 5px;
"
>
通报批次
</div>
<ul class="list-group" style="margin: 0 10px">
<li class="list-group-item">
<a
href="{% url 'polls_media_unqualified' %}?province={{province}}&cities={{city}}&district={{district}}&level={{level}}&version=0"
>2021.03.24通报</a
>
</li>
</ul>
</div>
</div>
</div>
{% endblock%} {% block add_js %} {% endblock %}

View File

@ -27,7 +27,9 @@ urlpatterns = [
path('medias/create/', views.create_media, name='polls_add_media'),
path('medias/update/', views.update_media, name='polls_update_media'),
path('medias/list/', views.medias, name='polls_medias'),
path('medias/admin/list/', views.media_admins, name='polls_media_admins'),
path('medias/my/', views.my_medias, name='polls_my_medias'),
path('medias/admin/my/', views.my_media_admins, name='polls_my_media_admins'),
path('medias/admin/change/', views.media_admin_change,
name='polls_media_admin_change'),
path('medias/<str:type>/<str:media_id>/',
@ -44,6 +46,8 @@ urlpatterns = [
path('monitor/city/ranking/', views.city_ranking, name='polls_city_ranking'),
path('monitor/result/', views.monitor_result,
name='polls_monitor_result'),
path('monitor/media/unqualified_index', views.monitor_unqualified_index,
name='polls_media_unqualified_index'),
path('monitor/media/unqualified',
views.monitor_unqualified_result, name='polls_media_unqualified'),
path('tasks/list/', views.tasks, name='polls_tasks_list'),

View File

@ -1,8 +1,8 @@
from .user import index, status_500, status_401, polls_login, send_code, register_step_one, register_step_two, password_recover_step_one, password_recover_step_two, reset_password, upload_profile
from .notice import notices, notice_top, read_notice, pass_notice, reject_notice, detail_notice, unread_notice_count
from .media import medias, my_medias, create_media, update_media, media_detail, delete_media, media_admin_change
from .media import medias, media_admins, my_medias, create_media, update_media, media_detail, delete_media, media_admin_change, my_media_admins
from .news import news_list, news_top, news_detail
from .monitor import monitor_statistics, monitor_result, media_statistics, city_ranking, monitor_unqualified_result
from .monitor import monitor_statistics, monitor_result, media_statistics, city_ranking, monitor_unqualified_result, monitor_unqualified_index
from .task import tasks, create_task, create_test_task, get_task
from .group import groups, room, is_level1_or_leve2, group_member, group_manager, group_enter, group_leave, pick_groups
from .compartment import compartments

View File

@ -19,6 +19,21 @@ def medias(request):
new_medias = NewMedia.media_list(organization_id)
return JsonResponse({'status': 'success', 'message': new_medias}, safe=False)
@csrf_exempt
@polls_login_required
def media_admins(request):
if request.method == 'POST':
return HttpResponse(status=405)
organization_id = request.GET.get('organization_id')
profiles = Userprofile.objects.filter(organization_id=organization_id)
results = []
for p in profiles:
result = dict()
result['id'] = p.id
result['name'] = p.name
results.append(result)
return JsonResponse({'status': 'success', 'message': results}, safe=False)
@csrf_exempt
@polls_login_required
@ -31,6 +46,23 @@ def my_medias(request):
new_medias = NewMedia.media_list(organization_id)
return JsonResponse({'status': 'success', 'message': new_medias}, safe=False)
@csrf_exempt
@polls_login_required
def my_media_admins(request):
if request.method == 'POST':
return HttpResponse(status=405)
user = request.user
profile = user.userprofile_set.first()
organization_id = profile.organization.id
profiles = Userprofile.objects.filter(organization_id=organization_id)
results = []
for p in profiles:
result = dict()
result['id'] = p.id
result['name'] = p.name
results.append(result)
return JsonResponse({'status': 'success', 'message': results}, safe=False)
@csrf_exempt
@polls_login_required

View File

@ -144,6 +144,17 @@ def monitor_result(request):
return render(request, 'polls/monitor_result.html')
def monitor_unqualified_index(request):
if request.method == 'POST':
return HttpResponse(status=405)
province = request.GET.get('province', '')
cities = request.GET.get('cities', '')
district = request.GET.get('district', '')
level = request.GET.get('level', '0')
return render(request, 'polls/monitor_unqualified_index.html', {'level': level, 'province': province, 'cities': cities, 'district': district})
def monitor_unqualified_result(request):
if request.method == 'POST':
return HttpResponse(status=405)
@ -152,7 +163,6 @@ def monitor_unqualified_result(request):
district = request.GET.get('district', '')
version = request.GET.get('version', '0')
level = request.GET.get('level', '0')
print(province, cities, district, level, version)
q = UnqualifiedMedia.objects.filter(version=version).order_by('cities')
if province:
q = q.filter(province=province)

View File

@ -64,6 +64,7 @@ def polls_login(request):
result['thumbnail'] = request.build_absolute_uri(
profile.image.url) if profile.image else None
result['organization'] = profile.organization.name
result['level'] = profile.organization.level.level
profile.platform = platform
profile.save()
return JsonResponse({'status': 'success', 'message': result})