apply_bool = lambda q, b: b and q or ~q
return self.filter(*[apply_bool(models.Q(state_string__contains="(%s)" % s), b) for s, b in kwargs.items()])
+ def children_count(self, child_type):
+ return NodeMetaClass.types[child_type].objects.filter_state(deleted=False).filter(parent__in=self).count()
+
class NodeManager(CachedManager):
use_for_related_fields = True
-{% load i18n %}\r
-{% load humanize %}\r
+{% spaceless %}\r
+{% load i18n humanize extra_tags %}\r
+{% declare %}\r
+ answer_count = questions.children_count('answer')\r
+{% enddeclare %}\r
\r
<div class="boxC">\r
<div class="questions-count">\r
- {{ questions_count }}<span style="color:black;font-size:14px;margin-left:5px">{{ list_description }}</span>\r
+ {{ questions.paginator.count }}<span style="color:black;font-size:14px;margin-left:5px">{{ list_description }}</span>\r
</div>\r
\r
\r
{% if answer_count %}\r
<div class="questions-count">\r
- {{ answer_count }}<span style="color:black;font-size:14px;margin-left:5px">{{ answer_description }}</span>\r
+ {{ answer_count }}<span style="color:black;font-size:14px;margin-left:5px">{% trans "answers" %}</span>\r
</div>\r
\r
{% endif %}\r
{{ questions.paginator.sort_description }}\r
</p>\r
</div>\r
-</div>
\ No newline at end of file
+</div>\r
+{% endspaceless %}
\ No newline at end of file
return pagination.paginated(request, ('questions', paginator_context or QuestionListPaginatorContext()), {
"questions" : questions,
"questions_count" : questions.count(),
- "answer_count" : answer_count,
"keywords" : keywords,
"list_description": list_description,
- "answer_description": answer_description,
"base_path" : base_path,
"page_title" : page_title,
"tab" : "questions",