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.

Files changed (69) hide show
  1. cfl_common/common/csp_config.py +0 -2
  2. cfl_common/common/mail.py +31 -6
  3. cfl_common/common/migrations/0005_add_worksheets.py +1 -5
  4. cfl_common/common/migrations/0007_add_pdf_names_to_first_two_worksheets.py +1 -5
  5. cfl_common/common/migrations/0054_delete_aimmo_models.py +20 -0
  6. cfl_common/common/models.py +0 -25
  7. {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/METADATA +3 -4
  8. {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/RECORD +44 -68
  9. example_project/portal_test_settings.py +0 -1
  10. example_project/settings.py +0 -1
  11. example_project/urls.py +0 -2
  12. portal/__init__.py +1 -1
  13. portal/static/portal/sass/partials/_banners.scss +0 -177
  14. portal/static/portal/sass/partials/_buttons.scss +0 -12
  15. portal/static/portal/sass/partials/_grids.scss +0 -53
  16. portal/static/portal/sass/partials/_text.scss +1 -10
  17. portal/static/portal/sass/styles.scss +0 -1
  18. portal/strings/play.py +1 -2
  19. portal/strings/teacher_resources.py +0 -10
  20. portal/templates/portal/about.html +91 -60
  21. portal/templates/portal/contribute.html +45 -49
  22. portal/templates/portal/partials/header.html +0 -12
  23. portal/templates/portal/play/independent_student_dashboard.html +12 -25
  24. portal/templates/portal/play/student_dashboard.html +16 -34
  25. portal/templates/portal/play.html +36 -49
  26. portal/templates/portal/register.html +1 -1
  27. portal/templates/portal/teach.html +37 -55
  28. portal/templates/portal/ten_year_map.html +9 -9
  29. portal/templatetags/app_tags.py +13 -28
  30. portal/tests/conftest.py +4 -16
  31. portal/tests/pageObjects/portal/base_page.py +20 -20
  32. portal/tests/snapshots/snap_test_partials.py +0 -452
  33. portal/tests/test_class.py +213 -45
  34. portal/tests/test_independent_student.py +0 -9
  35. portal/tests/test_partials.py +6 -56
  36. portal/tests/test_teacher.py +221 -285
  37. portal/tests/test_views.py +257 -73
  38. portal/urls.py +38 -20
  39. portal/views/cron/user.py +158 -15
  40. portal/views/student/play.py +36 -25
  41. portal/views/teacher/teach.py +0 -5
  42. cfl_common/common/tests/test_migration_aimmo_characters.py +0 -29
  43. portal/forms/add_game.py +0 -29
  44. portal/static/portal/img/kurono_hero.jpg +0 -0
  45. portal/static/portal/img/kurono_landing_hero.png +0 -0
  46. portal/static/portal/img/kurono_logo.svg +0 -1
  47. portal/static/portal/img/kurono_logo_grey_background.svg +0 -1
  48. portal/static/portal/img/kurono_logo_mark.svg +0 -1
  49. portal/static/portal/img/kurono_resources_hero.jpg +0 -0
  50. portal/static/portal/img/kurono_story.png +0 -0
  51. portal/static/portal/img/thumbnail_educate_kurono.png +0 -0
  52. portal/static/portal/img/thumbnail_kurono_resources.png +0 -0
  53. portal/static/portal/img/thumbnail_play_kurono.png +0 -0
  54. portal/static/portal/js/aimmoGame.js +0 -106
  55. portal/static/portal/sass/partials/_videos.scss +0 -10
  56. portal/static/portal/video/aimmo_play_now_background_video.mp4 +0 -0
  57. portal/strings/student_aimmo_dashboard.py +0 -6
  58. portal/templates/portal/partials/aimmo_games_table.html +0 -89
  59. portal/templates/portal/play/student_aimmo_dashboard.html +0 -46
  60. portal/templates/portal/teach/teacher_aimmo_dashboard.html +0 -95
  61. portal/templatetags/character_list_tags.py +0 -16
  62. portal/tests/pageObjects/portal/kurono_teacher_dashboard_page.py +0 -49
  63. portal/tests/test_aimmo_dashboards.py +0 -206
  64. portal/tests/utils/aimmo_games.py +0 -30
  65. portal/views/aimmo/__init__.py +0 -0
  66. portal/views/aimmo/dashboard.py +0 -105
  67. {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/LICENSE.md +0 -0
  68. {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/WHEEL +0 -0
  69. {codeforlife_portal-6.46.1.dist-info → codeforlife_portal-7.1.0.dist-info}/top_level.txt +0 -0
@@ -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
- ]