When you got “NameError: name ‘Count’ is not defined” when doing annotate query. Remember to import Count from django.db.models.
1 2 3 | from django.db.models import Count q = Insurance.objects.annotate(Count(‘created’)) |
Somehow it’s missing in the Django documentation 🙂