from django.db.models import Count, Case, When, IntegerField
Article.objects.annotate(numviews=Count(Case(When(readership__what_time__lt
    =treshold, then=1), output_field=CharField())))
How to annotate Count with a condition in a Django queryset