Django ORM(Querysets)
장고 쉘, 장고 인터랙티브 콘솔에서 사용. Querysets => 전달받은 모델의 객체 목록. DB로부터 데이터를 읽고 필터를 걸거나 정렬을 할 수 있다. 장고 쉘, 인터랙티브 콘솔 진입 python manage.py shell 모든 객체 조회 모든 객체 이전에는 model import가 필수 from blog.models import Post >>> Post.object.all() Post model을 blog.models에서 불러와 전부 조회 객체 생성 유저모델을 불러와 사용자 글 추가, 작성. from django.contrib.auth.models import User usermodel 불러오기 User.objects.all() 유저목록 확인 me = User.objects.get(username..
Programming/Django
2020. 12. 29. 18:14
최근댓글