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.
我需要按一对多的字段进行过滤,但我只想显示相关对象而不是全部。
这可能吗,还是我必须创建一个自定义过滤器?
我尽量让我的模板保持“愚蠢”,所以我肯定会在视图中过滤我的数据。你可以尝试这样的事情:
filtered_results = [ row for row in results if row['key'] == 'value' ]