diff --git a/game/templates/game/python_den_level_selection.html b/game/templates/game/python_den_level_selection.html index 940d64748..9c6be6710 100644 --- a/game/templates/game/python_den_level_selection.html +++ b/game/templates/game/python_den_level_selection.html @@ -149,7 +149,18 @@

Introduction to Python

{% for level in episode.levels %} {% for worksheet in episode.worksheets %} {% if worksheet.before_level == level.id %} - {% if user|is_logged_in %} + {% if not user|is_logged_in or user.new_student.class_field in worksheet.locked_classes.all %} + {% if not user|is_logged_in %} +

In order to access the full content for this course, please log in.

+ {% endif %} +
+ {{episode.name}} +
+
+ + Worksheet +
+ {% else %}
{{episode.name}}
@@ -178,15 +189,6 @@

Introduction to Python

Worksheet {% endif %} - {% else %} -

In order to access the full content for this course, please log in.

-
- {{episode.name}} -
-
- - Worksheet -
{% endif %} {% endif %} {% endfor %} @@ -220,7 +222,18 @@

Introduction to Python

{% endfor %} {% for worksheet in episode.worksheets %} {% if not worksheet.before_level %} - {% if user|is_logged_in %} + {% if not user|is_logged_in or user.new_student.class_field in worksheet.locked_classes.all %} + {% if not user|is_logged_in %} +

In order to access the full content for this course, please log in.

+ {% endif %} +
+ {{episode.name}}{% if episode.worksheets|length > 1 %} pt. {{ forloop.counter }}{% endif %} +
+
+ + Worksheet +
+ {% else %}
{{episode.name}}{% if episode.worksheets|length > 1 %} pt. {{ forloop.counter }}{% endif %}
@@ -249,15 +262,6 @@

Introduction to Python

Worksheet {% endif %} - {% else %} -

In order to access the full content for this course, please log in.

-
- {{episode.name}}{% if episode.worksheets|length > 1 %} pt. {{ forloop.counter }}{% endif %} -
-
- - Worksheet -
{% endif %} {% endif %} {% endfor %} diff --git a/game/views/level_selection.py b/game/views/level_selection.py index 5fea8ba32..9779757bd 100644 --- a/game/views/level_selection.py +++ b/game/views/level_selection.py @@ -251,6 +251,11 @@ def levels(request, language): id=level["id"] ).locked_for_class + for worksheet in episode["worksheets"]: + worksheet["locked_classes"] = Worksheet.objects.get( + id=worksheet["id"] + ).locked_classes + context["pythonEpisodes"] = python_episodes return context