如何使用相同的查询参数获取多个结果 [英] how to get multiple results using same query params django
本文介绍了如何使用相同的查询参数获取多个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以通过在Django中使用相同的查询参数来获取两个结果.我发现第二个值覆盖了第一个值
Is there a way to get two results from using the same query params in django. I find the second value overwrites the first
例如:
http://localhost:8000/?id=3&id=4
结果返回 id = 4
的值,但我想要 id = 3
和 id = 4
the result returns the value with id=4
but i want result for id=3
and id=4
推荐答案
What you want is the getlist()
function of the QueryDict.
request.GET.getlist('myvar')
这篇关于如何使用相同的查询参数获取多个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文