diff --git a/dashboard/models.py b/dashboard/models.py index 9e0ec99..987207e 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -114,6 +114,8 @@ class Organizationtype(models.Model): return self.organizationtype # 单位 + + class Organization(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) name = models.CharField('单位名', max_length=256, null=True, blank=True) @@ -375,6 +377,7 @@ class NewMedia(models.Model): result['alias'] = o.alias result['status'] = o.status result['type'] = 'weixin' + result['subtype'] = '' results.append(result) for o in weibo: result = dict() @@ -383,6 +386,7 @@ class NewMedia(models.Model): result['alias'] = o.alias result['status'] = o.status result['type'] = 'weibo' + result['subtype'] = '' results.append(result) for o in toutiao: result = dict() @@ -391,6 +395,7 @@ class NewMedia(models.Model): result['alias'] = o.alias result['status'] = o.status result['type'] = 'toutiao' + result['subtype'] = '' results.append(result) for o in douyin: result = dict() @@ -399,6 +404,7 @@ class NewMedia(models.Model): result['alias'] = o.alias result['status'] = o.status result['type'] = 'douyin' + result['subtype'] = '' results.append(result) for o in qita: result = dict() @@ -407,6 +413,7 @@ class NewMedia(models.Model): result['alias'] = o.alias result['status'] = o.status result['type'] = 'qita' + result['subtype'] = o.type results.append(result) return results @@ -424,12 +431,13 @@ class Weixin_data(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) weixin = models.ForeignKey( Weixin, on_delete=models.CASCADE, null=True, blank=True) - mp = models.CharField('mp',max_length=256,null=True,blank=True) - title = models.CharField('标题',max_length=256,null=True,blank=True) - content = models.TextField('content',null=True,blank=True) - author = models.CharField('author',max_length=256,null=True,blank=True) - timestamp = models.CharField('timestamp',max_length=256,null=True,blank=True) - link = models.CharField('link',max_length=2560,null=True,blank=True) + mp = models.CharField('mp', max_length=256, null=True, blank=True) + title = models.CharField('标题', max_length=256, null=True, blank=True) + content = models.TextField('content', null=True, blank=True) + author = models.CharField('author', max_length=256, null=True, blank=True) + timestamp = models.CharField( + 'timestamp', max_length=256, null=True, blank=True) + link = models.CharField('link', max_length=2560, null=True, blank=True) created = models.DateTimeField('创建时间', auto_now_add=True) updated = models.DateTimeField('更新时间', auto_now=True) @@ -526,9 +534,10 @@ class Toutiao_data(models.Model): toutiao = models.ForeignKey( Toutiao, on_delete=models.CASCADE, null=True, blank=True) tid = models.CharField('tid', max_length=256, null=True, blank=True) - celltype = models.CharField('celltype', max_length=256, null=True, blank=True) + celltype = models.CharField( + 'celltype', max_length=256, null=True, blank=True) title = models.CharField('标题', max_length=256, null=True, blank=True) - content = models.TextField('内容',null=True,blank=True) + content = models.TextField('内容', null=True, blank=True) time = models.CharField('时间', max_length=256, null=True, blank=True) url = models.CharField('链接', max_length=256, null=True, blank=True) commentcount = models.IntegerField('评论量', null=True, blank=True) @@ -552,15 +561,16 @@ class Toutiao_comment(models.Model): # toutiao = models.ForeignKey( # Toutiao, on_delete=models.CASCADE, null=True, blank=True) - type = models.CharField('type',max_length=256,null=True,blank=True) - tid = models.CharField('tid',max_length=256,null=True,blank=True) - cid = models.CharField('cid',max_length=256,null=True,blank=True) - rid = models.CharField('rid',max_length=256,null=True,blank=True) - username = models.CharField('username',max_length=256,null=True,blank=True) - content = models.TextField('content',null=True,blank=True) - time = models.CharField('time',max_length=256,null=True,blank=True) - reply_count = models.IntegerField('reply_count',null=True,blank=True) - diggcount = models.IntegerField('diggcount',null=True,blank=True) + type = models.CharField('type', max_length=256, null=True, blank=True) + tid = models.CharField('tid', max_length=256, null=True, blank=True) + cid = models.CharField('cid', max_length=256, null=True, blank=True) + rid = models.CharField('rid', max_length=256, null=True, blank=True) + username = models.CharField( + 'username', max_length=256, null=True, blank=True) + content = models.TextField('content', null=True, blank=True) + time = models.CharField('time', max_length=256, null=True, blank=True) + reply_count = models.IntegerField('reply_count', null=True, blank=True) + diggcount = models.IntegerField('diggcount', null=True, blank=True) created = models.DateTimeField('创建时间', auto_now_add=True) updated = models.DateTimeField('更新时间', auto_now=True) @@ -741,7 +751,8 @@ class TimelinessMonitoring(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) n_type = models.CharField('新媒体类型', max_length=256, null=True, blank=True) # name = models.ForeignKey(NewMedia,on_delete=models.CASCADE) - identificationcode = models.CharField('新媒体标识码', max_length=256, null=True, blank=True) + identificationcode = models.CharField( + '新媒体标识码', max_length=256, null=True, blank=True) results = models.CharField('监测结果', max_length=256, null=True, blank=True) update = models.IntegerField('更新次数', null=True, blank=True) silent = models.IntegerField('静默日数', null=True, blank=True) @@ -772,30 +783,39 @@ class Wrongly(models.Model): def __str__(self): return self.title -#评论临时表 +# 评论临时表 + + class Comment(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) comment = models.TextField('评论', null=True, blank=True) user = models.CharField('用户', max_length=256, null=True, blank=True) reply = models.TextField('回复', null=True, blank=True) - name = models.CharField('新媒体名称',max_length=256, null=True, blank=True) - title = models.CharField('标题',max_length=256, null=True, blank=True) - date = models.CharField('时间',max_length=256, null=True, blank=True) - url = models.CharField('文章链接',max_length=256, null=True, blank=True) + name = models.CharField('新媒体名称', max_length=256, null=True, blank=True) + title = models.CharField('标题', max_length=256, null=True, blank=True) + date = models.CharField('时间', max_length=256, null=True, blank=True) + url = models.CharField('文章链接', max_length=256, null=True, blank=True) created = models.DateTimeField('创建时间', auto_now_add=True) updated = models.DateTimeField('更新时间', auto_now=True) def __str__(self): return self.user -#新媒体更新表(国办) +# 新媒体更新表(国办) + + class Newmediaupdate(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) - organization_name = models.CharField('单位全称',max_length=256,null=True,blank=True) - organization_id_code = models.CharField('单位唯一标识码',max_length=256,null=True,blank=True) - identificationcode = models.CharField('新媒体标识码',max_length=256,null=True,blank=True) - newmedia_name = models.CharField('账号名称',max_length=256,null=True,blank=True) - newmedia_type = models.CharField('账号类型',max_length=256,null=True,blank=True) + organization_name = models.CharField( + '单位全称', max_length=256, null=True, blank=True) + organization_id_code = models.CharField( + '单位唯一标识码', max_length=256, null=True, blank=True) + identificationcode = models.CharField( + '新媒体标识码', max_length=256, null=True, blank=True) + newmedia_name = models.CharField( + '账号名称', max_length=256, null=True, blank=True) + newmedia_type = models.CharField( + '账号类型', max_length=256, null=True, blank=True) function = models.CharField('功能', max_length=256, null=True, blank=True) province = models.CharField('省', max_length=256, null=True, blank=True) cities = models.CharField('市', max_length=256, null=True, blank=True) @@ -806,4 +826,4 @@ class Newmediaupdate(models.Model): updated = models.DateTimeField('更新时间', auto_now=True) def __str__(self): - return self.newmedia_name \ No newline at end of file + return self.newmedia_name diff --git a/polls/views/__pycache__/media.cpython-38.pyc b/polls/views/__pycache__/media.cpython-38.pyc index 1441cae..e874154 100644 Binary files a/polls/views/__pycache__/media.cpython-38.pyc and b/polls/views/__pycache__/media.cpython-38.pyc differ diff --git a/polls/views/__pycache__/user.cpython-38.pyc b/polls/views/__pycache__/user.cpython-38.pyc index 1f9c5e5..17250b3 100644 Binary files a/polls/views/__pycache__/user.cpython-38.pyc and b/polls/views/__pycache__/user.cpython-38.pyc differ diff --git a/polls/views/media.py b/polls/views/media.py index f8fd41c..ef728bb 100644 --- a/polls/views/media.py +++ b/polls/views/media.py @@ -148,6 +148,7 @@ def update_media(request): result['code'] = instance.code result['alias'] = instance.alias result['status'] = instance.status + result['type'] = instance.type result['attention'] = instance.attention result['remark'] = instance.remark result['organization'] = instance.organization.name @@ -162,18 +163,23 @@ def media_detail(request, type, media_id): if type == 'weixin': media = Weixin.objects.get(pk=media_id) result['media_id'] = media.weixinid + result['type'] = '微信', elif type == 'weibo': media = Weibo.objects.get(pk=media_id) result['media_id'] = media.weiboid + result['type'] = '微博', elif type == 'toutiao': media = Toutiao.objects.get(pk=media_id) result['media_id'] = media.toutiaoid + result['type'] = '头条', elif type == 'douyin': media = Douyin.objects.get(pk=media_id) result['media_id'] = media.douyinid + result['type'] = '抖音', else: media = Qita.objects.get(pk=media_id) result['media_id'] = media.qitaid + result['type'] = media.type, admins = [] for admin in media.organization.userprofile_set.exclude(admin_status=0): diff --git a/polls/views/user.py b/polls/views/user.py index bfdc72a..4c66b32 100644 --- a/polls/views/user.py +++ b/polls/views/user.py @@ -56,6 +56,7 @@ def polls_login(request): profile = u.userprofile_set.first() result['phone'] = u.username result['token'] = token.key + result['last_login'] = u.last_login if profile: result['name'] = profile.name result['department'] = profile.department