更新时间:2023-08-22 22:14:34
命名为 distinct
function:
Pass field name to distinct
function:
model_results = teilnehmer.objects.filter(**{filter: term}).order_by().distinct(field)
非常不安全,因为您应该将 GET
值验证,然后再将它们传递给 QuerySet
。也可以使用django表单?
Also your approach is very insecure because you should validate GET
values before passing them to QuerySet
. Use django forms maybe?
另请阅读有关 distinct的文档
function here
Also read the docs about distinct
function here