>>> import array >>> faq_db = Faq.objects.all().distinct() >>> a = array >>> for f in faq_db: ... a.append(Question.objects.filter(id=f).count()) ... a ... Traceback (most recent call last): File "", line 2, in AttributeError: 'module' object has no attribute 'append'