From 694ecd5a489530fb1f9322d562fa5938110f9bef Mon Sep 17 00:00:00 2001 From: baoliang Date: Mon, 26 Oct 2020 08:56:41 +0800 Subject: [PATCH] add message --- polls/urls.py | 1 + polls/views/__init__.py | 2 +- .../views/__pycache__/__init__.cpython-38.pyc | Bin 1555 -> 1584 bytes polls/views/__pycache__/media.cpython-38.pyc | Bin 7405 -> 7630 bytes polls/views/__pycache__/notice.cpython-38.pyc | Bin 5206 -> 5492 bytes polls/views/media.py | 23 +++--- polls/views/notice.py | 66 +++++++++++------- 7 files changed, 57 insertions(+), 35 deletions(-) diff --git a/polls/urls.py b/polls/urls.py index 61801a9..df27fe8 100644 --- a/polls/urls.py +++ b/polls/urls.py @@ -28,6 +28,7 @@ urlpatterns = [ path('medias/update/', views.update_media, name='polls_update_media'), path('medias/list/', views.medias, name='polls_medias'), path('medias/my/', views.my_medias, name='polls_my_medias'), + path('medias/admin/change/', views.media_admin_change, name='polls_media_admin_change'), path('medias///', views.media_detail, name='polls_media_detail'), path('medias/delete/', views.delete_media, name='polls_delete_media'), diff --git a/polls/views/__init__.py b/polls/views/__init__.py index c2d4bc5..fe7304a 100644 --- a/polls/views/__init__.py +++ b/polls/views/__init__.py @@ -1,6 +1,6 @@ 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 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 +from .media import medias, my_medias, create_media, update_media, media_detail, delete_media, media_admin_change from .news import news_list, news_top, news_detail from .monitor import monitor_statistics, monitor_result, media_statistics, city_ranking from .task import tasks, create_task, create_test_task, get_task diff --git a/polls/views/__pycache__/__init__.cpython-38.pyc b/polls/views/__pycache__/__init__.cpython-38.pyc index 029cb505c2bcc851190384013b0f8f6fec926ef4..103621d681d94be7fc7d9160cd21c82da8458e61 100644 GIT binary patch delta 421 zcmW-cOHRU26oz|AD+)9rghU0(tGtZ(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csPd)ry}oVW(L{S5EqWgqOIXM_Y-pkw1J`)!7Svg+C6Iv4 zb~IoKL{G#ip5_^@f2{4GcNcD)jMHHz)Dz&wE$C~pvBUbQL<`L%#m!}gEQ>6wn1#$5 zYCN~Sq3wb=66f}849cT9`&vJp49jWZ1h=tZMitbP3>MT?!A$5P%d0XDckp%Z@Cj7h zW!71tD%?ZufcqouF{Kqyd&mnTZ5Fj{hZj-&hnGg8$tQ;lFY}O1;T1Z*@iZ2;Fu_MY zqpmIN75R~U!1GacE{)H#%Z$$@T4OTN_NMk3Fzi+KQ7;=$u#D$7{U_K)|*}gv`W^qI!g)qqUM7tBqKeH>(4zeO>bp>yg$-;!sQu1Ib>vNtD*LHX_Jmrele~C1Q`OBY zkArhQRC5IO~8%b{4B}v8O+hdGa5jXB1$b5FCz@R(cF5? zC~CahytWmH3OQdPr`_b&+nq)fH{-2He(SWhS5dxf{U1Cqd!qYx`&tkUpm$kU@kpCu zjfyOe;RKb-sk}}%ZnuIS3ei=B;iSz&vv!f|IAse=G<}40GM8W;T#bTBCUi7f2wDjf zO$EW?__K%}5qvf2ehQUyc$YXsP$!_ii1P#&2rkNd-ke?|dP)A})pCdWB%kxkC2EMc zLZJ4xN$jeO{71^FC$2, 4->5 + profiles = ReplyModel.objects.filter( + organization_id=notice.record_id) + if pass_value == '2': # 市级提交,1->2, 4->5 for p in profiles: if p.admin_status == 1: p.admin_status = 2 @@ -134,9 +146,9 @@ def pass_notice(request): p.save() admins = Userprofile.level1_admin() for a in admins: - Notice.create_reply_notice(a.user.id, notice.content, notice.app, notice.model, notice.field, notice.record_id, '3', '0') - return JsonResponse({'status': 'success', 'message': '申请已同意'}) - else: #省级提交 + Notice.create_reply_notice( + a.user.id, notice.content, notice.app, notice.model, notice.field, notice.record_id, '3', '0') + else: # 省级提交 for p in profiles: if p.admin_status == 5: p.admin_status = 0 @@ -144,6 +156,7 @@ def pass_notice(request): if p.admin_status == 2: p.admin_status = 3 p.save() + return JsonResponse({'status': 'success', 'message': '申请已同意'}) else: m = ReplyModel.objects.get(pk=notice.record_id) setattr(m, notice.field, notice.record_pass_value) @@ -154,11 +167,13 @@ def pass_notice(request): if pass_value == '2': admins = Userprofile.level1_admin() for a in admins: - Notice.create_reply_notice(a.user.id, notice.content, notice.app, notice.model, notice.field, notice.record_id, '3', '0') + Notice.create_reply_notice( + a.user.id, notice.content, notice.app, notice.model, notice.field, notice.record_id, '3', '0') if pass_value == '5': admins = Userprofile.level1_admin() for a in admins: - Notice.create_reply_notice(a.user.id, notice.content, notice.app, notice.model, notice.field, notice.record_id, '0', '3') + Notice.create_reply_notice( + a.user.id, notice.content, notice.app, notice.model, notice.field, notice.record_id, '0', '3') return JsonResponse({'status': 'success', 'message': '申请已同意'}) except ObjectDoesNotExist: return JsonResponse({'status': 'error', 'message': '通知ID错误'}) @@ -178,7 +193,8 @@ def reject_notice(request): ReplyModel = apps.get_model(notice.app, notice.model) if notice.model == 'Userprofile': reject_value = notice.record_reject_value - profiles = ReplyModel.objects.filter(organization_id=notice.record_id) + profiles = ReplyModel.objects.filter( + organization_id=notice.record_id) for p in profiles: if p.admin_status == 1 or p.admin_status == 2: p.admin_status = 0 @@ -206,5 +222,3 @@ def unread_notice_count(request): user_id = request.user.id count = Notice.objects.filter(user_id=user_id, is_read=False).count() return JsonResponse({'status': 'success', 'message': count}) - -