diff --git a/survey/templates/survey/question.html b/survey/templates/survey/question.html
index 69fc0ef6..37265ee7 100644
--- a/survey/templates/survey/question.html
+++ b/survey/templates/survey/question.html
@@ -9,7 +9,7 @@
-->
{% for form in response_form %}
- {% if form.field.widget.attrs.category == category.name or not form.field.widget.attrs.category %}
+ {% if form.field.widget.attrs.category == category.name or category.name == 'No category' and not form.field.widget.attrs.category %}
{{ form.label|safe }}
diff --git a/survey/tests/views/test_survey_category.py b/survey/tests/views/test_survey_category.py
index a6bc7aa4..093757fd 100644
--- a/survey/tests/views/test_survey_category.py
+++ b/survey/tests/views/test_survey_category.py
@@ -14,3 +14,12 @@ def test_category_description_none_not_shown(self):
"""
response = self.client.get(reverse("survey-detail", args=(13,)))
self.assertNotContains(response, "None")
+
+ def test_without_category_not_duplicated(self):
+ """
+ Checks that question without category is not duplicated when there is
+ a question with category in the same survey.
+
+ """
+ response = self.client.get(reverse("survey-detail", args=(13,)))
+ self.assertContains(response, "Question without category", count=1)
|