Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下有效的代码,
for x in SomeModel.objects.filter(type__label='ABC'):
现在'ABC'是标签之一。如何找出我可以过滤的其他标签?
我不完全确定你在问什么。的可能值是(可能)模型字段中type__label的值。你可以得到一个列表:labelType
type__label
label
Type
Type.objects.values_list('label', flat=True)
或者,正如大卫在评论中建议的那样,只需查看管理界面即可。