Home  >  Q&A  >  body text

python - Flask web开发的关注文章部分,属性方法followed_posts调用无效,shell里指令直接写入user.id有效?

PHP中文网PHP中文网2741 days ago265

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:16:53

    It was solved later
    I was hit on the console

    Post.query.join(Follow, Follow.followed_id == Post.author_id)\
                 .filter(Follow.follower_id == cat.id)

    Copy and paste it, change cat to self, and change it to the same code I typed before
    Then it’s OK...


    But I definitely played like this before

    Post.query.join(Follow, Follow.followed_id == Post.author_id)\
                 .filter(Follow.follower_id == self.id)

    Checked many times

    reply
    0
  • PHPz

    PHPz2017-04-18 10:16:53

    There is no problem with the query statement. Are the prerequisites not done well? For example, the user has not followed anyone? ? ?
    Look at mine:

    reply
    0
  • Cancelreply