From 1b41271a9c10376a8efb999d2b54389bd84ed360 Mon Sep 17 00:00:00 2001 From: baoliang Date: Fri, 9 Oct 2020 20:09:15 +0800 Subject: [PATCH] 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>1WN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