Commit 09ae3321 authored by 段英荣's avatar 段英荣

modify

parent 65e5a924
...@@ -13,10 +13,10 @@ from .user import User ...@@ -13,10 +13,10 @@ from .user import User
class PickUserRecord(models.Model): class PickUserRecord(models.Model):
class Meta: class Meta:
verbose_name = u'用户之间pick' verbose_name = u'用户pick帖子'
db_table = 'pickuserrecord' db_table = 'picktopicrecord'
pickuser_id = models.IntegerField(verbose_name="pick user id") picktopic_id = models.IntegerField(verbose_name="pick topic id")
is_deleted = models.BooleanField(verbose_name="是否删除") is_deleted = models.BooleanField(verbose_name="是否删除")
is_pick = models.BooleanField(verbose_name="is_pick") is_pick = models.BooleanField(verbose_name="is_pick")
create_time = models.DateTimeField(verbose_name=u'创建时间',default=datetime.datetime.fromtimestamp(0)) create_time = models.DateTimeField(verbose_name=u'创建时间',default=datetime.datetime.fromtimestamp(0))
......
...@@ -13,6 +13,7 @@ from libs.tools import tzlc ...@@ -13,6 +13,7 @@ from libs.tools import tzlc
from .group_user_role import GroupUserRole from .group_user_role import GroupUserRole
from .tag import AccountUserTag from .tag import AccountUserTag
from .topic import Topic
class User(models.Model): class User(models.Model):
...@@ -66,11 +67,17 @@ class User(models.Model): ...@@ -66,11 +67,17 @@ class User(models.Model):
return [] return []
def get_pick_user_id_list(self): def get_pick_user_id_list(self):
pick_user_id_list = list() pick_topic_id_list = list()
user_picks = self.user_pick.filter(is_deleted=False) user_picks = self.user_pick.filter(is_deleted=False,is_pick=True)
for user_pick in user_picks: for user_pick in user_picks:
pick_user_id_list.append(user_pick.pickuser_id) pick_topic_id_list.append(user_pick.picktopic_id)
pick_user_id_list = []
topic_sql_list = Topic.objects.filter(id__in=pick_topic_id_list)
for topic_data in topic_sql_list:
pick_user_id_list.append(topic_data.user_id)
pick_user_id_list = tuple(pick_user_id_list)
pick_user_detail_list = list() pick_user_detail_list = list()
sql_data_list = User.objects.filter(user_id__in=pick_user_id_list) sql_data_list = User.objects.filter(user_id__in=pick_user_id_list)
for detail_data in sql_data_list: for detail_data in sql_data_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