codeforlife-portal 6.46.1__py2.py3-none-any.whl → 7.1.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of codeforlife-portal might be problematic. Click here for more details.
- cfl_common/common/csp_config.py +0 -2
- cfl_common/common/mail.py +31 -6
- cfl_common/common/migrations/0005_add_worksheets.py +1 -5
- cfl_common/common/migrations/0007_add_pdf_names_to_first_two_worksheets.py +1 -5
- cfl_common/common/migrations/0054_delete_aimmo_models.py +20 -0
- cfl_common/common/models.py +0 -25
- {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/METADATA +3 -4
- {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/RECORD +44 -68
- example_project/portal_test_settings.py +0 -1
- example_project/settings.py +0 -1
- example_project/urls.py +0 -2
- portal/__init__.py +1 -1
- portal/static/portal/sass/partials/_banners.scss +0 -177
- portal/static/portal/sass/partials/_buttons.scss +0 -12
- portal/static/portal/sass/partials/_grids.scss +0 -53
- portal/static/portal/sass/partials/_text.scss +1 -10
- portal/static/portal/sass/styles.scss +0 -1
- portal/strings/play.py +1 -2
- portal/strings/teacher_resources.py +0 -10
- portal/templates/portal/about.html +91 -60
- portal/templates/portal/contribute.html +45 -49
- portal/templates/portal/partials/header.html +0 -12
- portal/templates/portal/play/independent_student_dashboard.html +12 -25
- portal/templates/portal/play/student_dashboard.html +16 -34
- portal/templates/portal/play.html +36 -49
- portal/templates/portal/register.html +1 -1
- portal/templates/portal/teach.html +37 -55
- portal/templates/portal/ten_year_map.html +9 -9
- portal/templatetags/app_tags.py +13 -28
- portal/tests/conftest.py +4 -16
- portal/tests/pageObjects/portal/base_page.py +20 -20
- portal/tests/snapshots/snap_test_partials.py +0 -452
- portal/tests/test_class.py +213 -45
- portal/tests/test_independent_student.py +0 -9
- portal/tests/test_partials.py +6 -56
- portal/tests/test_teacher.py +221 -285
- portal/tests/test_views.py +257 -73
- portal/urls.py +38 -20
- portal/views/cron/user.py +158 -15
- portal/views/student/play.py +36 -25
- portal/views/teacher/teach.py +0 -5
- cfl_common/common/tests/test_migration_aimmo_characters.py +0 -29
- portal/forms/add_game.py +0 -29
- portal/static/portal/img/kurono_hero.jpg +0 -0
- portal/static/portal/img/kurono_landing_hero.png +0 -0
- portal/static/portal/img/kurono_logo.svg +0 -1
- portal/static/portal/img/kurono_logo_grey_background.svg +0 -1
- portal/static/portal/img/kurono_logo_mark.svg +0 -1
- portal/static/portal/img/kurono_resources_hero.jpg +0 -0
- portal/static/portal/img/kurono_story.png +0 -0
- portal/static/portal/img/thumbnail_educate_kurono.png +0 -0
- portal/static/portal/img/thumbnail_kurono_resources.png +0 -0
- portal/static/portal/img/thumbnail_play_kurono.png +0 -0
- portal/static/portal/js/aimmoGame.js +0 -106
- portal/static/portal/sass/partials/_videos.scss +0 -10
- portal/static/portal/video/aimmo_play_now_background_video.mp4 +0 -0
- portal/strings/student_aimmo_dashboard.py +0 -6
- portal/templates/portal/partials/aimmo_games_table.html +0 -89
- portal/templates/portal/play/student_aimmo_dashboard.html +0 -46
- portal/templates/portal/teach/teacher_aimmo_dashboard.html +0 -95
- portal/templatetags/character_list_tags.py +0 -16
- portal/tests/pageObjects/portal/kurono_teacher_dashboard_page.py +0 -49
- portal/tests/test_aimmo_dashboards.py +0 -206
- portal/tests/utils/aimmo_games.py +0 -30
- portal/views/aimmo/__init__.py +0 -0
- portal/views/aimmo/dashboard.py +0 -105
- {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/LICENSE.md +0 -0
- {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/WHEEL +0 -0
- {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/top_level.txt +0 -0
portal/views/aimmo/dashboard.py
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
from typing import Any, Dict, List, Optional
|
|
2
|
-
|
|
3
|
-
from aimmo.models import Game
|
|
4
|
-
from aimmo.worksheets import WORKSHEETS, Worksheet, get_worksheets_excluding_id
|
|
5
|
-
from common.models import Class
|
|
6
|
-
from common.permissions import logged_in_as_student, logged_in_as_teacher
|
|
7
|
-
from common.utils import LoginRequiredNoErrorMixin
|
|
8
|
-
from django.contrib import messages
|
|
9
|
-
from django.contrib.auth.mixins import UserPassesTestMixin
|
|
10
|
-
from django.db.models import QuerySet
|
|
11
|
-
from django.urls import reverse_lazy
|
|
12
|
-
from django.views.generic.base import TemplateView
|
|
13
|
-
from django.views.generic.edit import CreateView
|
|
14
|
-
|
|
15
|
-
from portal.forms.add_game import AddGameForm
|
|
16
|
-
from portal.strings.student_aimmo_dashboard import AIMMO_DASHBOARD_BANNER
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class TeacherAimmoDashboard(LoginRequiredNoErrorMixin, UserPassesTestMixin, CreateView):
|
|
20
|
-
login_url = reverse_lazy("teacher_login")
|
|
21
|
-
form_class = AddGameForm
|
|
22
|
-
template_name = "portal/teach/teacher_aimmo_dashboard.html"
|
|
23
|
-
|
|
24
|
-
def test_func(self) -> Optional[bool]:
|
|
25
|
-
return logged_in_as_teacher(self.request.user)
|
|
26
|
-
|
|
27
|
-
def get_form(self, form_class=None):
|
|
28
|
-
teacher = self.request.user.new_teacher
|
|
29
|
-
non_admin_classes = teacher.class_teacher
|
|
30
|
-
admin_classes = Class.objects.filter(teacher__school=teacher.school)
|
|
31
|
-
classes = admin_classes if teacher.is_admin else non_admin_classes
|
|
32
|
-
if form_class is None:
|
|
33
|
-
form_class = self.get_form_class()
|
|
34
|
-
return form_class(classes, **self.get_form_kwargs())
|
|
35
|
-
|
|
36
|
-
def form_valid(self, form):
|
|
37
|
-
form.instance = Game(
|
|
38
|
-
game_class=form.cleaned_data["game_class"], created_by=self.request.user.userprofile.teacher
|
|
39
|
-
)
|
|
40
|
-
return super().form_valid(form)
|
|
41
|
-
|
|
42
|
-
def form_invalid(self, form: AddGameForm):
|
|
43
|
-
messages.warning(
|
|
44
|
-
self.request,
|
|
45
|
-
", ".join(message for errors in form.errors.values() for message in errors),
|
|
46
|
-
)
|
|
47
|
-
return super().form_invalid(form)
|
|
48
|
-
|
|
49
|
-
def get_success_url(self):
|
|
50
|
-
return reverse_lazy("teacher_aimmo_dashboard")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class StudentAimmoDashboard(LoginRequiredNoErrorMixin, UserPassesTestMixin, TemplateView):
|
|
54
|
-
template_name = "portal/play/student_aimmo_dashboard.html"
|
|
55
|
-
|
|
56
|
-
login_url = reverse_lazy("student_login_access_code")
|
|
57
|
-
|
|
58
|
-
def test_func(self) -> Optional[bool]:
|
|
59
|
-
return logged_in_as_student(self.request.user)
|
|
60
|
-
|
|
61
|
-
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
|
|
62
|
-
student = self.request.user.new_student
|
|
63
|
-
klass = student.class_field
|
|
64
|
-
|
|
65
|
-
if klass is None:
|
|
66
|
-
return {"BANNER": AIMMO_DASHBOARD_BANNER}
|
|
67
|
-
|
|
68
|
-
aimmo_game = klass.active_game
|
|
69
|
-
if aimmo_game:
|
|
70
|
-
active_worksheet = WORKSHEETS.get(aimmo_game.worksheet_id)
|
|
71
|
-
inactive_worksheets = get_worksheets_excluding_id(active_worksheet.id)
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
"BANNER": AIMMO_DASHBOARD_BANNER,
|
|
75
|
-
"HERO_CARD": self._get_hero_card(active_worksheet, aimmo_game),
|
|
76
|
-
"CARD_LIST": {"cards": self._get_card_list(inactive_worksheets)},
|
|
77
|
-
}
|
|
78
|
-
else:
|
|
79
|
-
return {"BANNER": AIMMO_DASHBOARD_BANNER}
|
|
80
|
-
|
|
81
|
-
def _get_hero_card(self, active_worksheet: Worksheet, aimmo_game: Game) -> Dict[str, Any]:
|
|
82
|
-
return {
|
|
83
|
-
"image": active_worksheet.active_image_path,
|
|
84
|
-
"title": active_worksheet.name,
|
|
85
|
-
"description": active_worksheet.description,
|
|
86
|
-
"button1": {
|
|
87
|
-
"text": "Read challenge",
|
|
88
|
-
"url": active_worksheet.student_challenge_url,
|
|
89
|
-
},
|
|
90
|
-
"button2": {
|
|
91
|
-
"text": "Play game",
|
|
92
|
-
"url": "kurono/play",
|
|
93
|
-
"url_args": aimmo_game.id,
|
|
94
|
-
},
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
def _get_card_list(self, inactive_worksheets: QuerySet) -> List[Dict[str, Any]]:
|
|
98
|
-
return [
|
|
99
|
-
{
|
|
100
|
-
"image": inactive_worksheet.image_path,
|
|
101
|
-
"title": inactive_worksheet.name,
|
|
102
|
-
"description": inactive_worksheet.short_description,
|
|
103
|
-
}
|
|
104
|
-
for inactive_worksheet in inactive_worksheets
|
|
105
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|