Commit 9839c2d1 authored by zhanglu's avatar zhanglu

帖子画报

parent 72d9423b
# from django.db import models
import datetime
from django.db import models
# class PictorialTopic(models.Model):
# """画报帖子关系"""
# class Meta:
# verbose_name = u'画报帖子关系'
# app_label = 'community'
# db_table = 'community_pictorial_topic'
class PictorialTopic(models.Model):
"""画报帖子关系"""
# id = models.IntegerField(verbose_name=u'日记ID', primary_key=True)
# pictorial_id = models.BigIntegerField(verbose_name=u'画报ID')
# topic_id = models.BigIntegerField(verbose_name=u'帖子ID')
# user_id = models.BigIntegerField(verbose_name=u'用户ID')
# is_online = models.BooleanField(verbose_name=u"是否有效", default=True)
# is_online = models.BooleanField(verbose_name=u'是否上线')
# is_deleted = models.BooleanField(verbose_name=u'是否删除')
class Meta:
verbose_name = u'画报帖子关系'
app_label = 'community'
db_table = 'community_pictorial_topic'
pictorial_id = models.BigIntegerField(verbose_name=u'画报ID')
topic_id = models.BigIntegerField(verbose_name=u'帖子ID')
is_online = models.BooleanField(verbose_name='是否上线')
is_deleted = models.BooleanField(verbose_name='是否删除')
create_time = models.DateTimeField(verbose_name=u'创建时间', default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'更新时间', default=datetime.datetime.fromtimestamp(0))
......@@ -16,6 +16,7 @@ from .pick_topic import PickTopic
from .tag import TopicTag, Tag
from .user_extra import UserExtra
from .group import Group
from .pictorial import PictorialTopic
class ActionSumAboutTopic(models.Model):
......@@ -83,6 +84,16 @@ class Topic(models.Model):
platform = models.IntegerField(verbose_name=u'平台来源', choices=GRAP_PLATFORM, default=GRAP_PLATFORM.ALPHA)
platform_id = models.BigIntegerField(verbose_name='用平台ID', null=True)
def get_pictorial_id(self):
try:
pictorial_id_list =[]
return list(PictorialTopic.objects.filter(
topic_id=self.id, is_online=True, is_deleted=False
).values_list("pictorial_id",flat=True))
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
@property
def is_complaint(self):
"""是否被举报"""
......
......@@ -34,6 +34,8 @@ class TopicTransfer(object):
res["group_id"] = -1
res["share_num"] = instance.share_num
res["pictorial_id"] = instance.get_pictorial_id()
begin = time.time()
res["pick_id_list"] = instance.get_pick_id_info()
end = time.time()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment