Skip to content

Instantly share code, notes, and snippets.

@KimSoungRyoul
Created May 6, 2019 05:14
Show Gist options
  • Save KimSoungRyoul/f56e414a0fc93ebbcf34dc422a8afba3 to your computer and use it in GitHub Desktop.
Save KimSoungRyoul/f56e414a0fc93ebbcf34dc422a8afba3 to your computer and use it in GitHub Desktop.
queryset 기본 구조
(Model.objects
.filter(조건절)
.select_related('정방향_참조_필드') # 해당 필드를 join해서 가져온다.
.prefetch_related('역방향_참조_필드') # 해당 필드는 추가쿼리로 가져온다.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment