From 7ce105c332651f36ef00ca8472bd0582d66a746b Mon Sep 17 00:00:00 2001 From: baoliang Date: Wed, 21 Oct 2020 21:37:19 +0800 Subject: [PATCH] add message --- dashboard/models.py | 10 +- polls/models.py | 5 +- polls/templates/polls/media_statistics.html | 178 +----------------- polls/templates/polls/monitor_statistics.html | 2 +- polls/views/__pycache__/media.cpython-38.pyc | Bin 6251 -> 6225 bytes .../views/__pycache__/monitor.cpython-38.pyc | Bin 3254 -> 3186 bytes polls/views/__pycache__/notice.cpython-38.pyc | Bin 4244 -> 4273 bytes polls/views/__pycache__/task.cpython-38.pyc | Bin 3883 -> 3879 bytes polls/views/media.py | 10 +- polls/views/monitor.py | 11 +- polls/views/notice.py | 2 + polls/views/task.py | 4 +- 12 files changed, 27 insertions(+), 195 deletions(-) diff --git a/dashboard/models.py b/dashboard/models.py index d6d4bfd..63eb3b2 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -130,6 +130,9 @@ class Organization(models.Model): def __str__(self): return self.name + def is_direct(self): + return self.province != '' and self.cities == '' + # 扩展用户表 class Userprofile(models.Model): @@ -166,9 +169,12 @@ 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 + if self.is_leve1: + return '省级管理员%s' % (self.name,) + elif self.is_level2: + return '市级管理员%s' % (self.name,) + return self.name def create_user_profile(sender, instance, created, **kwargs): diff --git a/polls/models.py b/polls/models.py index bd73def..ee242eb 100644 --- a/polls/models.py +++ b/polls/models.py @@ -45,6 +45,7 @@ class Notice(models.Model): type = models.IntegerField( 'category', choices=NOTICE_TYPE_CHOICES, default=0) content = models.CharField('内容', max_length=256, null=False) + group_id = models.CharField('group_id', max_length=256, null=True, blank=True) app = models.CharField('app', max_length=256, null=True, blank=True) model = models.CharField('model', max_length=256, null=True, blank=True) field = models.CharField('field', max_length=256, null=True, blank=True) @@ -67,8 +68,8 @@ class Notice(models.Model): return now <= self.timeouted @classmethod - def create_normal_notice(cls, user_id, content): - return Notice.objects.create(user_id=user_id, content=content) + def create_normal_notice(cls, user_id, content, group_id): + return Notice.objects.create(user_id=user_id, content=content, group_id=group_id) @classmethod def create_reply_notice(cls, user_id, content, app, model, field, record_id, record_pass_value, record_reject_value): diff --git a/polls/templates/polls/media_statistics.html b/polls/templates/polls/media_statistics.html index ac5ac5e..e9ea97e 100644 --- a/polls/templates/polls/media_statistics.html +++ b/polls/templates/polls/media_statistics.html @@ -17,90 +17,7 @@