diff --git a/templates/category.html b/templates/category.html
index 37d78bc..581b195 100644
--- a/templates/category.html
+++ b/templates/category.html
@@ -12,7 +12,7 @@
Kategoria: {{test.category}}
Próg zaliczenia: {{test.passing_score}}
-
Ilość pytań: {{test.questions|length}}
+
Ilość pytań: {{test.question_count}}
diff --git a/templates/home.html b/templates/home.html
index c3078e2..d60d4ad 100644
--- a/templates/home.html
+++ b/templates/home.html
@@ -12,7 +12,7 @@
Kategoria: {{test.category}}
Próg zaliczenia: {{test.passing_score}}
-
Ilość pytań: {{test.questions|length}}
+
Ilość pytań: {{test.question_count}}
diff --git a/templates/myTests.html b/templates/myTests.html
index 5d1bf94..0d00640 100644
--- a/templates/myTests.html
+++ b/templates/myTests.html
@@ -12,7 +12,7 @@
Kategoria: {{test.category}}
Próg zaliczenia: {{test.passing_score}}
-
Ilość pytań: {{test.questions|length}}
+
Ilość pytań: {{test.question_count}}
diff --git a/trials/models.py b/trials/models.py
index c9be013..e0741c6 100644
--- a/trials/models.py
+++ b/trials/models.py
@@ -1,4 +1,6 @@
from django.db import models
+
+from questions.models import Question
from .managers import TestManager
@@ -62,6 +64,9 @@ class Test(models.Model):
points += question.points
return points
+ def question_count(self):
+ return Question.objects.filter(test_id=self.id).count()
+
def name_and_passing_score(self):
return {
"name": self.name,