Commit 35ab8044 authored by 段英荣's avatar 段英荣

modify pictorial sort

parent f68bc9e3
...@@ -108,29 +108,21 @@ class Pictorial(models.Model): ...@@ -108,29 +108,21 @@ class Pictorial(models.Model):
def get_tag_by_id(self): def get_tag_by_id(self):
try: try:
tag_id_list = [] tag_id_list = PictorialTag.objects.filter(pictorial_id=self.id, is_online=True).values_list("tag_id", flat=True)
tags = PictorialTag.objects.filter(pictorial_id=self.id, is_online=True).values_list("tag_id", flat=True)
for i in tags:
tag_id_list.append(i)
return tag_id_list return tag_id_list
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False return []
def get_tag_by_name(self, tag_id): def get_tag_by_name(self, tag_id):
try: try:
tag_name_list = [] tag_name_list = Tag.objects.filter(id__in=tag_id, is_online=True).values_list("name", flat=True)
tags = Tag.objects.filter(id__in=tag_id, is_online=True).values_list("name", flat=True)
for i in tags:
tag_name_list.append(i)
return tag_name_list return tag_name_list
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False return []
class PictorialTag(models.Model): class PictorialTag(models.Model):
......
...@@ -59,9 +59,9 @@ class PictorialTransfer(object): ...@@ -59,9 +59,9 @@ class PictorialTransfer(object):
tzlc_udpate_time = tzlc(update_time) tzlc_udpate_time = tzlc(update_time)
res["update_time"] = tzlc_udpate_time res["update_time"] = tzlc_udpate_time
res["high_quality_topic_num"] = instance.get_high_quality_topic_num() res["high_quality_topic_num"] = instance.get_high_quality_topic_num()
tag_id = instance.get_tag_by_id() tag_id_list = instance.get_tag_by_id()
res["tag_id"] = tag_id res["tag_id"] = tag_id_list
res["tag_name"] = instance.get_tag_by_name(tag_id) res["tag_name"] = instance.get_tag_by_name(tag_id_list)
res["topic_id_list"] =instance.get_topic_id() res["topic_id_list"] =instance.get_topic_id()
res["effective"] = instance.get_effective(res["topic_id_list"]) res["effective"] = instance.get_effective(res["topic_id_list"])
res["offline_score"] = cls.get_offline_score(instance,res["topic_id_list"]) res["offline_score"] = cls.get_offline_score(instance,res["topic_id_list"])
......
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