728x90
Django에서 데이터 조회하기 명령어 예시입니다.
python manage.py shell
>>> from foods.models import Menu
>>> Menu.objects.all()
>>> Menu.objects.all().values()
>>> Menu.objects.all().values('price')
>>> Menu.objects.order_by('price')
>>> Menu.objects.order_by('-price')
>>> Menu.objects.filter(name__contains="코")
>>> Menu.objects.filter(price__range=(2000,10000))
>>> Menu.objects.get(id=1)
728x90