change new media model
This commit is contained in:
parent
52f1a7fa43
commit
9a51ff4ea5
|
@ -143,28 +143,35 @@ def create_user_profile(sender, instance, created, **kwargs):
|
||||||
profile.user = instance
|
profile.user = instance
|
||||||
profile.save()
|
profile.save()
|
||||||
|
|
||||||
|
NEWMEDIA_STATUS_CHOICES = (
|
||||||
# 微信公众号
|
|
||||||
class Weixin(models.Model):
|
|
||||||
WEIXIN_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)
|
||||||
weixinid = models.CharField('微信ID', 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)
|
||||||
image = models.FileField(
|
image = models.FileField(
|
||||||
upload_to='cover/%Y/%m/%d/', null=True, blank=True)
|
upload_to='cover/%Y/%m/%d/', null=True, blank=True)
|
||||||
organization = models.ForeignKey(
|
organization = models.ForeignKey(
|
||||||
Organization, on_delete=models.CASCADE, null=True, blank=True)
|
Organization, on_delete=models.CASCADE, null=True, blank=True)
|
||||||
status = models.CharField(
|
status = models.CharField(
|
||||||
'状态', max_length=256, null=True, blank=True, choices=WEIXIN_STATUS_CHOICES)
|
'状态', max_length=256, null=True, blank=True, choices=NEWMEDIA_STATUS_CHOICES)
|
||||||
created = models.DateTimeField('创建时间', auto_now_add=True)
|
created = models.DateTimeField('创建时间', auto_now_add=True)
|
||||||
updated = models.DateTimeField('更新时间', auto_now=True)
|
updated = models.DateTimeField('更新时间', auto_now=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
ordering = ["-created"]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.code
|
return self.code + ':' + self.alias
|
||||||
|
|
||||||
|
# 微信公众号
|
||||||
|
class Weixin(NewMedia):
|
||||||
|
weixinid = models.CharField('微信ID', max_length=256, null=True, blank=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 微信文章采集
|
# 微信文章采集
|
||||||
|
@ -220,26 +227,8 @@ class Weixin_Wrong(models.Model):
|
||||||
|
|
||||||
|
|
||||||
# 微博
|
# 微博
|
||||||
class Weibo(models.Model):
|
class Weibo(NewMedia):
|
||||||
WEIBO_STATUS_CHOICES = (
|
|
||||||
('1', '开启'),
|
|
||||||
('0', '关闭')
|
|
||||||
)
|
|
||||||
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
|
||||||
code = models.CharField('微博号', max_length=256, null=True, blank=True)
|
|
||||||
weiboid = models.CharField('微博ID', max_length=256, null=True, blank=True)
|
weiboid = models.CharField('微博ID', max_length=256, null=True, blank=True)
|
||||||
alias = models.CharField('别名', max_length=256, null=True, blank=True)
|
|
||||||
image = models.FileField(
|
|
||||||
upload_to='cover/%Y/%m/%d/', null=True, blank=True)
|
|
||||||
organization = models.ForeignKey(
|
|
||||||
Organization, on_delete=models.CASCADE, null=True, blank=True)
|
|
||||||
status = models.CharField(
|
|
||||||
'状态', max_length=256, null=True, blank=True, choices=WEIBO_STATUS_CHOICES)
|
|
||||||
created = models.DateTimeField('创建时间', auto_now_add=True)
|
|
||||||
updated = models.DateTimeField('更新时间', auto_now=True)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.code
|
|
||||||
|
|
||||||
|
|
||||||
# 微博文章采集
|
# 微博文章采集
|
||||||
|
@ -284,25 +273,7 @@ class Weibo_Wrong(models.Model):
|
||||||
|
|
||||||
# 今日头条
|
# 今日头条
|
||||||
class Toutiao(models.Model):
|
class Toutiao(models.Model):
|
||||||
TOUTIAO_STATUS_CHOICES = (
|
|
||||||
('1', '开启'),
|
|
||||||
('0', '关闭')
|
|
||||||
)
|
|
||||||
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
|
||||||
code = models.CharField('头条号', max_length=256, null=True, blank=True)
|
|
||||||
toutiaoid = models.CharField('头条ID', max_length=256, null=True, blank=True)
|
toutiaoid = models.CharField('头条ID', max_length=256, null=True, blank=True)
|
||||||
alias = models.CharField('别名', max_length=256, null=True, blank=True)
|
|
||||||
image = models.FileField(
|
|
||||||
upload_to='cover/%Y/%m/%d/', null=True, blank=True)
|
|
||||||
organization = models.ForeignKey(
|
|
||||||
Organization, on_delete=models.CASCADE, null=True, blank=True)
|
|
||||||
status = models.CharField(
|
|
||||||
'状态', max_length=256, null=True, blank=True, choices=TOUTIAO_STATUS_CHOICES)
|
|
||||||
created = models.DateTimeField('创建时间', auto_now_add=True)
|
|
||||||
updated = models.DateTimeField('更新时间', auto_now=True)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return self.code
|
|
||||||
|
|
||||||
|
|
||||||
# 今日头条数据
|
# 今日头条数据
|
||||||
|
@ -360,23 +331,9 @@ class Toutiao_Wrong(models.Model):
|
||||||
|
|
||||||
# 其他新媒体
|
# 其他新媒体
|
||||||
class Qita(models.Model):
|
class Qita(models.Model):
|
||||||
QITA_STATUS_CHOICES = (
|
|
||||||
('1', '开启'),
|
|
||||||
('0', '关闭')
|
|
||||||
)
|
|
||||||
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
|
|
||||||
type = models.CharField('新媒体类型', max_length=256, null=True, blank=True)
|
type = models.CharField('新媒体类型', max_length=256, null=True, blank=True)
|
||||||
name = models.CharField('新媒体名称', max_length=256, null=True, blank=True)
|
name = models.CharField('新媒体名称', max_length=256, null=True, blank=True)
|
||||||
qitaid = models.CharField('新媒体ID', max_length=256, null=True, blank=True)
|
qitaid = models.CharField('新媒体ID', max_length=256, null=True, blank=True)
|
||||||
alias = models.CharField('别名', max_length=256, null=True, blank=True)
|
|
||||||
image = models.FileField(
|
|
||||||
upload_to='cover/%Y/%m/%d/', null=True, blank=True)
|
|
||||||
organization = models.ForeignKey(
|
|
||||||
Organization, on_delete=models.CASCADE, null=True, blank=True)
|
|
||||||
status = models.CharField(
|
|
||||||
'状态', max_length=256, null=True, blank=True, choices=QITA_STATUS_CHOICES)
|
|
||||||
created = models.DateTimeField('创建时间', auto_now_add=True)
|
|
||||||
updated = models.DateTimeField('更新时间', auto_now=True)
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
Loading…
Reference in New Issue