文章詳情頁(yè)
django進(jìn)行數(shù)據(jù)庫(kù)的查詢
瀏覽:231日期:2022-06-09 16:54:56
問題描述
class User(models.Model):
username = models.Charfield()
class Topic(models.Model):
# 發(fā)帖人
user = models.ForeignKey(User)
class Reply(models.Model):
topic = models.ForeignKey(Topic)
# 回復(fù)的人
user = models.ForeignKey(User)
現(xiàn)在需要查詢出一個(gè)用戶的發(fā)的帖子的所有的回復(fù)
user = User.objects.get(pk=5)
replies = Reply.objects.filter(topic.user.id==user.id)
一直報(bào)錯(cuò):
SyntaxError: keyword can't be an expression
請(qǐng)問得怎么處理,才可以獲取所有的回復(fù)。
問題解答
回答1:django不熟,幫不了你哈,打破0回復(fù),~~
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””2. docker-compose中volumes的問題3. boot2docker無法啟動(dòng)4. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.5. nignx - docker內(nèi)nginx 80端口被占用6. dockerfile - 為什么docker容器啟動(dòng)不了?7. node.js - antdesign怎么集合react-redux對(duì)input控件進(jìn)行初始化賦值8. docker容器呢SSH為什么連不通呢?9. java - SSH框架中寫分頁(yè)時(shí)service層中不能注入分頁(yè)類10. 關(guān)于docker下的nginx壓力測(cè)試
排行榜

熱門標(biāo)簽
網(wǎng)公網(wǎng)安備