def get_context_data(self, **kwargs): context = ProjectDiscussionListView.get_context_data(self, **kwargs) allowed_categories = self.get_specific_types().values_list('allowed_category_tree', flat=True).distinct() root_category = None if allowed_categories.count(): root_category = TaggedCategory.objects.get(id=allowed_categories[0]) context.update({ 'tab_name' : 'support', 'prop_count' : len([q for q in context["specific_questions"] if q.type.type == "pj-help"]), 'call_count' : len([q for q in context["specific_questions"] if q.type.type == "pj-need"]), 'need_count' : len(context["specific_questions"]), 'root_category' : root_category, }) return context
def get_context_data(self, **kwargs): context = ProjectDiscussionListView.get_context_data(self, **kwargs) allowed_categories = self.get_specific_types().values_list('allowed_category_tree', flat=True).distinct() root_category = None if allowed_categories.count(): root_category = TaggedCategory.objects.get(id=allowed_categories[0]) prop_count = len([q for q in context["specific_questions"] if q.type.type == "pj-help"]) call_count = len([q for q in context["specific_questions"] if q.type.type == "pj-need"]) need_count = prop_count + call_count discussion_count = SpecificQuestion.objects.filter(type__in=SpecificQuestionType.objects.filter(type="pj-discuss"), object_id=self.context_object.pk).count() context.update({ 'tab_name' : 'support', 'prop_count' : prop_count, 'call_count' : call_count, 'need_count' : need_count, 'discussion_count' : discussion_count, 'root_category' : root_category, }) return context