Django : select_related with ManyToManyField

荒凉一梦 提交于 2019-11-29 03:08:23
Vebjorn Ljosa

Django versions 1.4 and above have prefetch_related for this purpose.

The prefetch_related method is similar to select_related, but does not do a database join. Instead, it executes additional database queries and does the joining in Python.

If you're not on Django 1.4, there's also the django-batch-select library, which works basically the same way as prefetch_related.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!