0
如何在django中进行这样的查询。在查询中查询django
我有网站模型,我可以找到与主题模型的关系。在主题模型中,我可以关联后期模型。我想从网站提取帖子,其中只有关于网站的信息,而不是主题。什么是更多的帖子必须以查询开始。
query = request.GET.get('query','')
iweb_obj = IWeb.objects.get(id=iweb_id)
topics = Topic.objects.filter(iweb=iweb_obj)
iweb_posts = []
for t in topics:
posts = Post.objects.filter(topic=t)
for p in posts:
iweb_posts.append(p)
iweb_posts = iweb_.filter(content__istartswith=query)
我有一个错误,iweb_posts isnt查询设置,我不能做这样的行动。这很明显,但是我不知道如何使它工作?我听说我可以使用过滤器(** kwargs),但我不知道如何使用它?