From 1b41271a9c10376a8efb999d2b54389bd84ed360 Mon Sep 17 00:00:00 2001 From: baoliang Date: Fri, 9 Oct 2020 20:09:15 +0800 Subject: [PATCH 1/2] refact groupuser --- dashboard/models.py | 19 +- polls/templates/polls/city_ranking.html | 131 ++++++++++++++ polls/templates/polls/media_statistics.html | 167 ++++++++++++++++++ polls/urls.py | 6 +- polls/views/__init__.py | 2 +- .../views/__pycache__/__init__.cpython-38.pyc | Bin 1189 -> 1239 bytes polls/views/__pycache__/group.cpython-38.pyc | Bin 1255 -> 1283 bytes polls/views/__pycache__/media.cpython-38.pyc | Bin 5912 -> 6251 bytes .../views/__pycache__/monitor.cpython-38.pyc | Bin 2888 -> 3254 bytes polls/views/group.py | 5 +- polls/views/media.py | 53 ++++-- polls/views/monitor.py | 15 +- 12 files changed, 358 insertions(+), 40 deletions(-) create mode 100644 polls/templates/polls/city_ranking.html create mode 100644 polls/templates/polls/media_statistics.html diff --git a/dashboard/models.py b/dashboard/models.py index a90b264..028dcb7 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -55,29 +55,15 @@ class Group(models.Model): def __str__(self): return self.name -# 矩阵管理员 - -class Group_admin(models.Model): - id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) - user = models.ForeignKey( - User, on_delete=models.CASCADE, null=True, blank=True) - group = models.ForeignKey( - Group, on_delete=models.CASCADE, null=True, blank=True) - created = models.DateTimeField('创建时间', auto_now_add=True) - updated = models.DateTimeField('更新时间', auto_now=True) - - def __str__(self): - return self.group.name # 矩阵成员 - - -class Group_user(models.Model): +class GroupUser(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) user = models.ForeignKey( User, on_delete=models.CASCADE, null=True, blank=True) group = models.ForeignKey( Group, on_delete=models.CASCADE, null=True, blank=True) + is_admin = models.BooleanField('是否管理', default=False) created = models.DateTimeField('创建时间', auto_now_add=True) updated = models.DateTimeField('更新时间', auto_now=True) @@ -157,7 +143,6 @@ class Userprofile(models.Model): def level1_admin(cls): return Userprofile.objects.filter(organization__level__level=1) - def __str__(self): return self.user.username+":"+self.name diff --git a/polls/templates/polls/city_ranking.html b/polls/templates/polls/city_ranking.html new file mode 100644 index 0000000..a3cb014 --- /dev/null +++ b/polls/templates/polls/city_ranking.html @@ -0,0 +1,131 @@ +{% extends 'polls/base.html' %} +{% block content%} +
+

市州合格率排行榜

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
不合格合格数量合格率
武威市044100.0%
天水市01313100.0%
金昌市2535596.4%
嘉峪关市3444793.6%
甘肃省2013215286.8%
兰州市4252986.2%
平凉市5293485.3%
庆阳市2713716483.5%
白银市3151883.3%
临夏州27977.8%
兰州新区12395176.5%
甘南州26875.0%
定西市381172.7%
酒泉市36966.7%
陇南市12172958.6%
张掖市34757.1%
+
+{% endblock%} diff --git a/polls/templates/polls/media_statistics.html b/polls/templates/polls/media_statistics.html new file mode 100644 index 0000000..13809de --- /dev/null +++ b/polls/templates/polls/media_statistics.html @@ -0,0 +1,167 @@ +{% extends 'polls/base.html' %} +{% load static %} +{% block content%} +
+
+
+
+
+
+
+{% endblock%} +{% block add_js %} + + +{% endblock %} \ No newline at end of file diff --git a/polls/urls.py b/polls/urls.py index eb774da..792a68f 100644 --- a/polls/urls.py +++ b/polls/urls.py @@ -19,7 +19,8 @@ urlpatterns = [ path('notices/read/', views.read_notice, name='polls_read_notice'), path('notices/pass/', views.pass_notice, name='polls_pass_notice'), path('notices/reject/', views.reject_notice, name='polls_reject_notice'), - path('notices/detail//', views.detail_notice, name='polls_detail_notice'), + path('notices/detail//', + views.detail_notice, name='polls_detail_notice'), 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'), @@ -33,6 +34,9 @@ urlpatterns = [ views.news_detail, name='polls_news_detail'), path('monitor/statistics/', views.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, name='polls_monitor_result'), path('tasks/list/', views.tasks, name='polls_tasks_list'), diff --git a/polls/views/__init__.py b/polls/views/__init__.py index d0ffea6..bea72a5 100644 --- a/polls/views/__init__.py +++ b/polls/views/__init__.py @@ -2,7 +2,7 @@ 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 .media import medias, my_medias, create_media, update_media, media_detail, delete_media 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 .group import groups, room from .compartment import compartments diff --git a/polls/views/__pycache__/__init__.cpython-38.pyc b/polls/views/__pycache__/__init__.cpython-38.pyc index a013a9a2ae42c2e6e903753b6f2764ee6a6ee170..01e681ae41d40d51987a8963984dbecc4f60f7d0 100644 GIT binary patch delta 289 zcmW-bK~94}6o#3KRuGadT)418fkF#y?PW~NiwT(kK~f%&nQ`I9J2dnPnz;5BUciKS z1P|d1FZsXx|F?SY#*bk?*tV(3d-{G$e~!z@>EejSZ6-j(*Y_Iyh-{`G*L$1k;STg?~*hsDb delta 238 zcmW-aJqp4=5QQ`GH_?EFr9VkbG#d3RHa1fzL4$=mMm7-y!8?RKgMziK_YhKh5O*{1 zKHmG9`5F(yT3eQ>$-BMo+fQ!w;g^T`3behpud^Z9Xp@5ux#*Uz!A9hvM?U)HZn7~= za8h=I1r%UFQ=FFDWHSmeq&d#tUDyHW;;MV%qYGGwRpq%Us#%mCc~8FQeT9KUQ9JPD za^^!NYzb`b5;{jbqxh6@M`>4KBvCXdPSfZRb5AK>;-&GW>PxYyCT0h^(1EthA88;r A=>Px# diff --git a/polls/views/__pycache__/group.cpython-38.pyc b/polls/views/__pycache__/group.cpython-38.pyc index 077da0fd15498bba190e195db7181383ef6266da..a1edd342197f0103794b58970a1519e60fba3726 100644 GIT binary patch delta 147 zcmaFP+04Zo%FD~e00eS!4e|OLd9N^Xu>yI{KwP|H@@qyXW}SZv@J&WU&JPP0J`8 delta 139 zcmZqXdd|rk%FD~e00i%M)y4B}B?c`}AfZedCm zU@GDV%H85f&PgmT&P=PE%*#BVwMYyoHhC+vp{^Q`0a8#b2P7Dnxfr<^IT-mESs3}4 e1b`$5BO8#%#VEwc!&sy?S(s%bquS)7EOr2N6B@Aq diff --git a/polls/views/__pycache__/media.cpython-38.pyc b/polls/views/__pycache__/media.cpython-38.pyc index 26d5a0d537c65fa88dda271737e6ac25da907d8e..507844a6e1b1fcb2fb8c419d3ebdf9cff72964b5 100644 GIT binary patch delta 1824 zcmb7FO>Y}T7~WZb?5?wR?8Iw3A5NUacIuXfkW%`U&=dk`ps1lu10safc-+YA#G>OZ zgla5P<-!H2(nuwO9_(9tYZWdWKnPVFK->_Z{R72-fD3{n?>h-eKMqw_+DFgKJp0bO z-sc%_jQlnlIu{HE6u7dX50>V$w?k=fdjy7Ua6b=s^`t6Jc)zc!c7S%2RrWLOtf(|v zYvW#OmDQ_+d1&U{GMEp=<4>yf%S z+6%hi{kl37OiJM_2>Yav(|!muk_*%~-Tyv%PZgFL7Ys&Q(N=~U* z%|%2@KN?{j*n(cFRGoaKP-Mr&lg1J9r6?KuNr(8{NQ>``4!DOsCeg)hE3O7S;+EB| zvboJr;Iv9+#9L-M_6$_HNnG`vGCKm49YdH98|LLhhmfKz*--=oVI0Aa@GOFkFbUvl z)uNMk9LA=_OfU(>mxGhZ8C;&nWj`xcFReIi7H3{XSP*xDLu5((5?m&9b2fB|A3oubYpZtG?fb684Z7xOzNF6d@ z(N3AJH5%pGQjBYjIHto%G`b)WI@e_)3~E6jx@8~&PEVtk8@6gEAq+9@r*W>?Nt&Qt z+ku#>oT1$hROx$E3qta+nIP>Q zSAcf|OG>8N1Hk)$w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Q?|`hm@Nk`$ zNt3LfY0nV80P!W#Dq;`f%cNbzE2KlNoN0KKbnj{Xjc=-hIm!)A6GC|(^OV-?z@g^a&B}Q9`K-QCsQ_Lltckvkzb51^5hTW)us*A+)PJ@G|WV&5{Stt4LI>xdP-<4xDI)4 zC@8j2>_e@qSkK~9WCVhO@2Hxqpr^oBu&rQ6fogGS3dN9%`C7L?KaJ^a1PpNlz%3)U QBzw+Pw}h(q;Z)T54dsHpq5uE@ delta 457 zcmYk2J4*vW6oq$^eat@c@U<}#k_ZZ}(TJ6e*jXxqh%ilvnMIA6U76h#e}EQthG_*m zLA0^4u(R_wY-KB0_^9l>vxPXtH}{@%xty8D>Wf?4DHJRP&R6rab3QUG*3ikYRh?rh zQJF?GrW2hR#9)|Uq)>(C2PU(K#cX0juMSU|-c^}6bb`8P3MtSEorJqctJ{h<^(Hsp zqEzR8Kz;u3{;eTLyy~^F5*Qvz%^+bN=F`J2FN=~ Date: Sat, 10 Oct 2020 15:46:04 +0800 Subject: [PATCH 2/2] add group profile --- dashboard/models.py | 21 +++++- polls/urls.py | 3 + polls/views/__init__.py | 2 +- .../views/__pycache__/__init__.cpython-38.pyc | Bin 1239 -> 1315 bytes polls/views/__pycache__/group.cpython-38.pyc | Bin 1283 -> 2710 bytes polls/views/__pycache__/user.cpython-38.pyc | Bin 5598 -> 5598 bytes polls/views/group.py | 65 ++++++++++++++++-- 7 files changed, 82 insertions(+), 9 deletions(-) diff --git a/dashboard/models.py b/dashboard/models.py index 028dcb7..a90b264 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -55,15 +55,29 @@ class Group(models.Model): def __str__(self): return self.name +# 矩阵管理员 -# 矩阵成员 -class GroupUser(models.Model): + +class Group_admin(models.Model): + id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) + user = models.ForeignKey( + User, on_delete=models.CASCADE, null=True, blank=True) + group = models.ForeignKey( + Group, on_delete=models.CASCADE, null=True, blank=True) + created = models.DateTimeField('创建时间', auto_now_add=True) + updated = models.DateTimeField('更新时间', auto_now=True) + + def __str__(self): + return self.group.name +# 矩阵成员 + + +class Group_user(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) user = models.ForeignKey( User, on_delete=models.CASCADE, null=True, blank=True) group = models.ForeignKey( Group, on_delete=models.CASCADE, null=True, blank=True) - is_admin = models.BooleanField('是否管理', default=False) created = models.DateTimeField('创建时间', auto_now_add=True) updated = models.DateTimeField('更新时间', auto_now=True) @@ -143,6 +157,7 @@ class Userprofile(models.Model): def level1_admin(cls): return Userprofile.objects.filter(organization__level__level=1) + def __str__(self): return self.user.username+":"+self.name diff --git a/polls/urls.py b/polls/urls.py index 792a68f..deb467c 100644 --- a/polls/urls.py +++ b/polls/urls.py @@ -44,7 +44,10 @@ urlpatterns = [ path('tasks/create_test/', views.create_test_task, name='polls_tasks_create_test'), 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/manager/', views.group_manager, name='polls_groups_manager'), + path('groups/member/', views.group_member, name='polls_groups_member'), path('compartments/list/', views.compartments, name='polls_compartments_list'), path('organizations/list/', views.organizations, diff --git a/polls/views/__init__.py b/polls/views/__init__.py index bea72a5..f32fd58 100644 --- a/polls/views/__init__.py +++ b/polls/views/__init__.py @@ -4,7 +4,7 @@ from .media import medias, my_medias, create_media, update_media, media_detail, 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 -from .group import groups, room +from .group import groups, room, is_level1_or_leve2, group_member, group_manager from .compartment import compartments from .organizations import organizations, organization_level from .message import last_messages, send_text_message diff --git a/polls/views/__pycache__/__init__.cpython-38.pyc b/polls/views/__pycache__/__init__.cpython-38.pyc index 01e681ae41d40d51987a8963984dbecc4f60f7d0..9b1b001ea971e5810c5dc4a0f1a20c7a3d4eda2c 100644 GIT binary patch delta 247 zcmcc4xtNPDl$V!_0SKZK8{>JIC-TWK{+Ot}*CJOVN+VY@N;6k0N{f*pg&~C_M>|(1 zN(ap5%+bx&jnd84i_!!0xpMS#4WbNk4WkS=oT-OmzbBBo?0~d3sW?s(c}Q;YwktLK*trS zfCyC}5yhRHpIeYvRFa#TS5l+~5>^Kh8bIO}dv0oRF-X5ANJtAvtYj!M2CGtiX7Yk)P=nTY6D`X+iNVmZJRp+{uQ_(Tw_&dzr6UL~$qQ z=N2RumE@-8l@uuhEh|z15voAq7JF`LadBdLYLOa9NF7M5WGFHKu?;4#Vku@5VB}#G GU<3fJ{w)Il diff --git a/polls/views/__pycache__/group.cpython-38.pyc b/polls/views/__pycache__/group.cpython-38.pyc index a1edd342197f0103794b58970a1519e60fba3726..86c2390a9333d455e9609adb32977c348aa50773 100644 GIT binary patch literal 2710 zcmds(OOG2x5P+xWZF~G!?zfRw}fxEGQ$Kc%k-M2;M|a0yjCUgAXri7U3IT-C4YsrtIwH|q7O0iWO4 z*S&eoFn&T~`D24|79Q~!1T`p0jf{kZpl+sSW`$N}hqkt@)XCh?)w-Q}p$B7})Xyqm zMYp+WHLHa+t$S&Z)x)~h{j`xa!)DeBTVPjc^_~%~FqhS6jRyCOU9wBUwzliEv9MRQ z-K4FBy{7FI+Fsa4sC~`otUiHV8~a4LoQ)~t9a9CDq?}x3Vv>&qQ^BVqA0Jp9qG|)d zw|i`dWfQptHu)UH+9Xd?(M$7TJnnIJa~g9-p}l>%pRj>Emou@I%kw+2kl?_%$n)t$ z)ouvJCp_PdQ#K&Djl~Cb3!YEl5g2@F6cE>46ZUIv-7TGU2ct;#B-@eeBblY#gmK`} zL+?z;eS_Db<&V$0=tXqOf9JjQYO zM%`O6yDhpy-0%A2jt-5G>8K_1#W(twZN`xQ_MBZ0ktW%4yis7bB+oXA#bf1(>0rQw*f;qqxK~~VMl@s>V5lvkZPuwMH)C>?Q;r)|_7no7 znkW~^=m{p3vmJ9Gl}+P;RFxQ#%Wkps)H8L1J21UtbBqT+u6->QK$yfdl{y8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VwN5y!~$2t^PX^?7$m(;-){b0&zXLJWoI80c(2+||y2D`Dm< zYL$rmAmy==n)Z`SaiIxIVx=9agt%-TEFTopBxAkkK;~JYc&`wNxKhy-BGWV)kNJpo zJz*9^dzIjXiMF}XstKt*!DW$Q5y&-NU}1J(;mmx*O>|}|auuEB1Q37^O(1B?9SlBD zgaIr=2-V|md!E(yH^zCE$#ur#Ttq4tQkeD89hOF;LB5VzzRusqe5{guB!xe31)ayH p@oMiXqW_dsnv5LnZw_--WPHnPrd&Z6LK{o_c8ET7d}4zQe*r|x&H(@b diff --git a/polls/views/__pycache__/user.cpython-38.pyc b/polls/views/__pycache__/user.cpython-38.pyc index b7c761329b63a2eca8165bd758fcf731110837c0..96b34c108f7af88ffe0f7caf51ebb13411f855af 100644 GIT binary patch delta 79 zcmcboeNUS^l$V!_0SH!wHf-eH!N+)O^AWy@jEu>f!vt0{GNx>165?cHOr6XllFgX0 dxk7}QQ6L$px+n!iWPk|i$s0L^C(jdg003>P6tDmQ delta 79 zcmcboeNUS^l$V!_0SIJ;ayD}B;A4#1e1vZzBV*F$FoD&KjLDmsggBWPQzr9>WHY93 ct`K2n6i5Q9E=mRw=^#RS@