有没有过滤预取对象的方法?我需要获取预取对象的 latest() 但如果您使用 latest 因为查询已更改,则 prefetch_related 不起作用?
此处的示例满足了我的需要,但我希望有一个更简单的解决方法...
https://github.com/ionelmc/django-prefetch#example
最佳答案
从 Django 1.7 开始,过滤预取对象是可能的。见 this SO answer , 和 the Django documentation .
关于django - 在 Django 中过滤 prefetch_related,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10915319/