QuerySet
-
Django Manager, Queryset기술/Django 2021. 9. 24. 18:51
Django 에서 ORM 을 깔끔하게 사용할 수 있는 공식적인 방법 두가지가 있는데 언제 어떻게 사용해야하는지에 대한 명확한 기준이 없어 고민하게 되었을 때 찾은 글입니다. Manager Django 는 Manager 를 통해 데이터베이스와 통신합니다. 응용프로그램과 데이터베이스 사이의 일종의 통신 게이트입니다. 따라서 모든 장고의 모델은 하나 이상의 Manager 가 존재합니다. Custom Manager 를 언제 사용하나요? 1. 초기 Queryset 을 수정하기 위한 목적 만약 Manager 에 따라 삭제된 것을 포함/미포함하여 가져오고 싶을 때, Manager 를 사용하여 첫 Queryset 에서 필터해서 가져오게 할 수 있습니다. from django.db import models class P..