This commit is contained in:
Bob 2020-09-13 17:30:46 +08:00
parent 42c9f4ee9c
commit accbbc42f1
2 changed files with 942 additions and 920 deletions

View File

@ -130,12 +130,12 @@ def create_user_profile(sender, instance, created, **kwargs):
profile.user = instance profile.user = instance
profile.save() profile.save()
class NewMedia(models.Model):
NEWMEDIA_STATUS_CHOICES = ( NEWMEDIA_STATUS_CHOICES = (
('1', '开启'), ('1', '开启'),
('0', '关闭') ('0', '关闭')
) )
class NewMedia(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
code = models.CharField('微信公众号', max_length=256, null=True, blank=True) code = models.CharField('微信公众号', max_length=256, null=True, blank=True)
alias = models.CharField('别名', max_length=256, null=True, blank=True) alias = models.CharField('别名', max_length=256, null=True, blank=True)
@ -319,6 +319,26 @@ class Toutiao_Wrong(models.Model):
return self.wrong return self.wrong
# 抖音
class Douyin(NewMedia):
douyinid = models.CharField('抖音ID', max_length=256, null=True, blank=True)
# 抖音数据
class Douyin_data(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
mewnedia = models.ForeignKey(Douyin, on_delete=models.CASCADE)
count = models.CharField('总发文量', max_length=256, null=True, blank=True)
count_jc = models.CharField(
'监测时间内发文量', max_length=256, null=True, blank=True)
comment = models.CharField('评论数', max_length=256, null=True, blank=True)
reply = models.CharField('作者回复数', max_length=256, null=True, blank=True)
date = 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.mewnedia.code
# 其他新媒体 # 其他新媒体
class Qita(NewMedia): class Qita(NewMedia):
type = models.CharField('新媒体类型', max_length=256, null=True, blank=True) type = models.CharField('新媒体类型', max_length=256, null=True, blank=True)
@ -363,16 +383,18 @@ class News(models.Model):
NEWMEDIA_NEWS_CHOICES = ( NEWMEDIA_NEWS_CHOICES = (
('0', '政策依据'), ('0', '政策依据'),
('1', '基层动态'), ('1', '基层动态'),
('2', '通知'), ('2', '外省动态'),
('3', '外省动态'), ('3', '监测通报'),
('4', '监测通报'), ('4', '舆情热点')
('5', '舆情热点')
) )
id = models.UUIDField('id',primary_key=True,default=uuid.uuid4) id = models.UUIDField('id',primary_key=True,default=uuid.uuid4)
type = models.CharField('文章类型',max_length=256,null=True,blank=True,choices=NEWMEDIA_NEWS_CHOICES) type = models.CharField('文章类型',max_length=256,null=True,blank=True,choices=NEWMEDIA_NEWS_CHOICES)
title = models.CharField('文章标题',max_length=256,null=True,blank=True) title = models.CharField('文章标题',max_length=256,null=True,blank=True)
image = models.FileField(
upload_to='news/%Y/%m/%d/', null=True, blank=True)
author = models.CharField('作者',max_length=256,null=True,blank=True) author = models.CharField('作者',max_length=256,null=True,blank=True)
date = models.CharField('发表日期',null=True,blank=True,max_length=256) date = models.CharField('发表日期',null=True,blank=True,max_length=256)
content = models.TextField('内容',null=True,blank=True) content = models.TextField('内容',null=True,blank=True)
def __str__(self): def __str__(self):
return self.title return self.title

View File

@ -444,7 +444,7 @@ def newmedia_management_create_menu(request):
def newmedia_management_create_weixin(request): def newmedia_management_create_weixin(request):
WEIXIN_STATUS_CHOICES = Weixin.WEIXIN_STATUS_CHOICES WEIXIN_STATUS_CHOICES = Weixin.NEWMEDIA_STATUS_CHOICES
weixin_status_choices_list = [] weixin_status_choices_list = []
for w in WEIXIN_STATUS_CHOICES: for w in WEIXIN_STATUS_CHOICES:
weixin_status_choices_list.append(list(w)[1]) weixin_status_choices_list.append(list(w)[1])
@ -483,7 +483,7 @@ def newmedia_management_create_weixin(request):
def newmedia_management_create_weibo(request): def newmedia_management_create_weibo(request):
WEIBO_STATUS_CHOICES = Weibo.WEIBO_STATUS_CHOICES WEIBO_STATUS_CHOICES = Weibo.NEWMEDIA_STATUS_CHOICES
weibo_status_choices_list = [] weibo_status_choices_list = []
for w in WEIBO_STATUS_CHOICES: for w in WEIBO_STATUS_CHOICES:
weibo_status_choices_list.append(list(w)[1]) weibo_status_choices_list.append(list(w)[1])
@ -523,7 +523,7 @@ def newmedia_management_create_weibo(request):
def newmedia_management_create_toutiao(request): def newmedia_management_create_toutiao(request):
TOUTIAO_STATUS_CHOICES = Toutiao.TOUTIAO_STATUS_CHOICES TOUTIAO_STATUS_CHOICES = Toutiao.NEWMEDIA_STATUS_CHOICES
toutiao_status_choices_list = [] toutiao_status_choices_list = []
for w in TOUTIAO_STATUS_CHOICES: for w in TOUTIAO_STATUS_CHOICES:
toutiao_status_choices_list.append(list(w)[1]) toutiao_status_choices_list.append(list(w)[1])
@ -563,7 +563,7 @@ def newmedia_management_create_toutiao(request):
def newmedia_management_create_qita(request): def newmedia_management_create_qita(request):
QITA_STATUS_CHOICES = Qita.QITA_STATUS_CHOICES QITA_STATUS_CHOICES = Qita.NEWMEDIA_STATUS_CHOICES
qita_status_choices_list = [] qita_status_choices_list = []
for w in QITA_STATUS_CHOICES: for w in QITA_STATUS_CHOICES:
qita_status_choices_list.append(list(w)[1]) qita_status_choices_list.append(list(w)[1])