최근 며칠 데이터 가져오기 요거 많이 쓸 듯
아래 사이트에서 가져옴
https://chartio.com/resources/tutorials/how-to-filter-for-empty-or-null-values-in-a-django-queryset/
Now, by using filter(), we can retrieve a QuerySet of just those books that were published within the last 90 days period, like so:
>>> from datetime import datetime, timedelta
>>> Book.objects.filter(date_published__gte=datetime.now() - timedelta(days=90)).count()
3
그리고, NULL 체크하는 방법은 isnull 사용하는 것
Here we can use isnull to find all Books where the author field is NULL:
>>> Book.objects.filter(author__isnull=True).count()
2
Empty 체크는 exact
we can approximate that functionality with the exact field lookup instead:
>>> Book.objects.filter(title__exact='').count()
엄청 유용한 정보였음
Pavel Danilyuk 님의 사진, 출처: Pexels