Django queries database
欢乐时光马上就要开始了
欢乐时光马上就要开始了 2019-08-17 20:37:31
0
1
1082

class User(models.Model):

username = models.Charfield()


class Topic(models.Model):

# Posted by

user = models.ForeignKey(User)


class Reply(models.Model):

topic = models.ForeignKey(Topic)

# Respondent

user = models.ForeignKey(User)



Now we need to query all the replies to posts posted by a user

user = User.objects.get(pk=5)

replies = Reply. objects.filter(topic.user.id==user.id)

Always reports an error:

SyntaxError: keyword can't be an expression

May I ask? How to deal with it so that you can get all the replies.

欢乐时光马上就要开始了
欢乐时光马上就要开始了

reply all (1)
殘留の回憶

I’m not familiar with django, so I can’t help you. I broke 0 replies,~~

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!