prefetch_related django code example

Example 1: django select_related and prefetch_related

django select_related and prefetch_related

select_related >> foreignkey
prefetch_related >> many to many
basically they are performance boosters ,used to avoid multiple unnecessary queries
Both methods achieve the same purpose, to forego unnecessary db queries. 
But they use different approaches for efficiency..

Example 2: django 3.0 queryset examples

>>> Entry.objects.filter(
...     headline__startswith='What'
... ).exclude(
...     pub_date__gte=datetime.date.today()
... ).filter(
...     pub_date__gte=datetime.date(2005, 1, 30)
... )