codeforlife-portal 6.45.6__py2.py3-none-any.whl → 6.46.1__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/migrations/0053_clean_class_data.py +24 -0
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.1.dist-info}/METADATA +2 -2
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.1.dist-info}/RECORD +20 -11
- portal/__init__.py +1 -1
- portal/static/portal/img/howe_dell_1.png +0 -0
- portal/static/portal/img/howe_dell_2.png +0 -0
- portal/static/portal/img/howe_dell_3.png +0 -0
- portal/static/portal/img/long_europe_map.png +0 -0
- portal/static/portal/img/ten_year_map_pin.svg +1 -0
- portal/static/portal/js/tenYearMap.js +14 -0
- portal/static/portal/sass/partials/_carousel.scss +21 -0
- portal/static/portal/sass/partials/_images.scss +281 -0
- portal/strings/ten_year_map.py +13 -0
- portal/templates/portal/ten_year_map.html +147 -0
- portal/tests/test_views.py +53 -151
- portal/urls.py +22 -39
- portal/views/home.py +82 -37
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.1.dist-info}/LICENSE.md +0 -0
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.1.dist-info}/WHEEL +0 -0
- {codeforlife_portal-6.45.6.dist-info → codeforlife_portal-6.46.1.dist-info}/top_level.txt +0 -0
portal/views/home.py
CHANGED
|
@@ -33,30 +33,19 @@ from portal.helpers.ratelimit import (
|
|
|
33
33
|
)
|
|
34
34
|
from portal.strings.coding_club import CODING_CLUB_BANNER
|
|
35
35
|
from portal.strings.home_learning import HOME_LEARNING_BANNER
|
|
36
|
+
from portal.strings.ten_year_map import (
|
|
37
|
+
TEN_YEAR_MAP_BANNER,
|
|
38
|
+
TEN_YEAR_MAP_HEADLINE,
|
|
39
|
+
)
|
|
36
40
|
from portal.templatetags.app_tags import cloud_storage
|
|
37
|
-
from portal.views.teacher.teach import
|
|
41
|
+
from portal.views.teacher.teach import (
|
|
42
|
+
DownloadType,
|
|
43
|
+
count_student_pack_downloads_click,
|
|
44
|
+
)
|
|
38
45
|
|
|
39
46
|
LOGGER = logging.getLogger(__name__)
|
|
40
47
|
|
|
41
48
|
|
|
42
|
-
def teach_email_labeller(request):
|
|
43
|
-
if request.method == "POST" and "teacher_login" in request.POST:
|
|
44
|
-
return request.POST["login-teacher_email"]
|
|
45
|
-
|
|
46
|
-
return ""
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def play_name_labeller(request):
|
|
50
|
-
if request.method == "POST":
|
|
51
|
-
if "school_login" in request.POST:
|
|
52
|
-
return request.POST["login-name"] + ":" + request.POST["login-access_code"]
|
|
53
|
-
|
|
54
|
-
if "independent_student_login" in request.POST:
|
|
55
|
-
return request.POST["independent_student-username"]
|
|
56
|
-
|
|
57
|
-
return ""
|
|
58
|
-
|
|
59
|
-
|
|
60
49
|
def register_view(request):
|
|
61
50
|
if request.user.is_authenticated:
|
|
62
51
|
return redirect_user_to_dashboard(request)
|
|
@@ -82,11 +71,15 @@ def render_signup_form(request):
|
|
|
82
71
|
invalid_form = False
|
|
83
72
|
|
|
84
73
|
teacher_signup_form = TeacherSignupForm(prefix="teacher_signup")
|
|
85
|
-
independent_student_signup_form = IndependentStudentSignupForm(
|
|
74
|
+
independent_student_signup_form = IndependentStudentSignupForm(
|
|
75
|
+
prefix="independent_student_signup"
|
|
76
|
+
)
|
|
86
77
|
|
|
87
78
|
if request.method == "POST":
|
|
88
79
|
if "teacher_signup-teacher_email" in request.POST:
|
|
89
|
-
teacher_signup_form = TeacherSignupForm(
|
|
80
|
+
teacher_signup_form = TeacherSignupForm(
|
|
81
|
+
request.POST, prefix="teacher_signup"
|
|
82
|
+
)
|
|
90
83
|
|
|
91
84
|
if not captcha.CAPTCHA_ENABLED:
|
|
92
85
|
remove_captcha_from_forms(teacher_signup_form)
|
|
@@ -140,11 +133,15 @@ def process_signup_form(request, data):
|
|
|
140
133
|
[email],
|
|
141
134
|
personalization_values={
|
|
142
135
|
"EMAIL": email,
|
|
143
|
-
"LOGIN_URL": request.build_absolute_uri(
|
|
136
|
+
"LOGIN_URL": request.build_absolute_uri(
|
|
137
|
+
reverse("teacher_login")
|
|
138
|
+
),
|
|
144
139
|
},
|
|
145
140
|
)
|
|
146
141
|
else:
|
|
147
|
-
LOGGER.warn(
|
|
142
|
+
LOGGER.warn(
|
|
143
|
+
f"Ratelimit teacher {RATELIMIT_USER_ALREADY_REGISTERED_EMAIL_GROUP}: {email}"
|
|
144
|
+
)
|
|
148
145
|
else:
|
|
149
146
|
teacher = Teacher.objects.factory(
|
|
150
147
|
first_name=data["teacher_first_name"],
|
|
@@ -155,9 +152,16 @@ def process_signup_form(request, data):
|
|
|
155
152
|
|
|
156
153
|
send_verification_email(request, teacher.user.user, data)
|
|
157
154
|
|
|
158
|
-
TotalActivity.objects.update(
|
|
155
|
+
TotalActivity.objects.update(
|
|
156
|
+
teacher_registrations=F("teacher_registrations") + 1
|
|
157
|
+
)
|
|
159
158
|
|
|
160
|
-
return render(
|
|
159
|
+
return render(
|
|
160
|
+
request,
|
|
161
|
+
"portal/email_verification_needed.html",
|
|
162
|
+
{"usertype": "TEACHER"},
|
|
163
|
+
status=302,
|
|
164
|
+
)
|
|
161
165
|
|
|
162
166
|
|
|
163
167
|
def process_independent_student_signup_form(request, data):
|
|
@@ -178,12 +182,21 @@ def process_independent_student_signup_form(request, data):
|
|
|
178
182
|
[email],
|
|
179
183
|
personalization_values={
|
|
180
184
|
"EMAIL": email,
|
|
181
|
-
"LOGIN_URL": request.build_absolute_uri(
|
|
185
|
+
"LOGIN_URL": request.build_absolute_uri(
|
|
186
|
+
reverse("independent_student_login")
|
|
187
|
+
),
|
|
182
188
|
},
|
|
183
189
|
)
|
|
184
190
|
else:
|
|
185
|
-
LOGGER.warning(
|
|
186
|
-
|
|
191
|
+
LOGGER.warning(
|
|
192
|
+
f"Ratelimit independent {RATELIMIT_USER_ALREADY_REGISTERED_EMAIL_GROUP}: {email}"
|
|
193
|
+
)
|
|
194
|
+
return render(
|
|
195
|
+
request,
|
|
196
|
+
"portal/email_verification_needed.html",
|
|
197
|
+
{"usertype": "INDEP_STUDENT"},
|
|
198
|
+
status=302,
|
|
199
|
+
)
|
|
187
200
|
|
|
188
201
|
student = Student.objects.independentStudentFactory(
|
|
189
202
|
name=data["name"], email=data["email"], password=data["password"]
|
|
@@ -195,13 +208,23 @@ def process_independent_student_signup_form(request, data):
|
|
|
195
208
|
|
|
196
209
|
send_verification_email(request, student.new_user, data, age=age)
|
|
197
210
|
|
|
198
|
-
TotalActivity.objects.update(
|
|
211
|
+
TotalActivity.objects.update(
|
|
212
|
+
independent_registrations=F("independent_registrations") + 1
|
|
213
|
+
)
|
|
199
214
|
|
|
200
|
-
return render(
|
|
215
|
+
return render(
|
|
216
|
+
request,
|
|
217
|
+
"portal/email_verification_needed.html",
|
|
218
|
+
{"usertype": "INDEP_STUDENT"},
|
|
219
|
+
status=302,
|
|
220
|
+
)
|
|
201
221
|
|
|
202
222
|
|
|
203
223
|
def is_developer(request):
|
|
204
|
-
return
|
|
224
|
+
return (
|
|
225
|
+
hasattr(request.user, "userprofile")
|
|
226
|
+
and request.user.userprofile.developer
|
|
227
|
+
)
|
|
205
228
|
|
|
206
229
|
|
|
207
230
|
def redirect_teacher_to_correct_page(request, teacher):
|
|
@@ -227,13 +250,18 @@ def redirect_teacher_to_correct_page(request, teacher):
|
|
|
227
250
|
|
|
228
251
|
@cache_control(private=True)
|
|
229
252
|
def home(request):
|
|
230
|
-
# Putting this in a try catch because it causes some weird issue in the
|
|
231
|
-
#
|
|
253
|
+
# Putting this in a try catch because it causes some weird issue in the
|
|
254
|
+
# tests where the first Selenium test passes, but any following test
|
|
255
|
+
# fails because it cannot find the Maintenance banner instance.
|
|
232
256
|
try:
|
|
233
|
-
maintenance_banner = DynamicElement.objects.get(
|
|
257
|
+
maintenance_banner = DynamicElement.objects.get(
|
|
258
|
+
name="Maintenance banner"
|
|
259
|
+
)
|
|
234
260
|
|
|
235
261
|
if maintenance_banner.active:
|
|
236
|
-
messages.info(
|
|
262
|
+
messages.info(
|
|
263
|
+
request, format_html(maintenance_banner.text), extra_tags="safe"
|
|
264
|
+
)
|
|
237
265
|
except ObjectDoesNotExist:
|
|
238
266
|
pass
|
|
239
267
|
|
|
@@ -251,7 +279,9 @@ def home(request):
|
|
|
251
279
|
|
|
252
280
|
|
|
253
281
|
def coding_club(request):
|
|
254
|
-
return render(
|
|
282
|
+
return render(
|
|
283
|
+
request, "portal/coding_club.html", {"BANNER": CODING_CLUB_BANNER}
|
|
284
|
+
)
|
|
255
285
|
|
|
256
286
|
|
|
257
287
|
def download_student_pack(request, student_pack_type):
|
|
@@ -266,7 +296,22 @@ def download_student_pack(request, student_pack_type):
|
|
|
266
296
|
|
|
267
297
|
|
|
268
298
|
def home_learning(request):
|
|
269
|
-
return render(
|
|
299
|
+
return render(
|
|
300
|
+
request,
|
|
301
|
+
"portal/home_learning.html",
|
|
302
|
+
{"HOME_LEARNING_BANNER": HOME_LEARNING_BANNER},
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def ten_year_map_page(request):
|
|
307
|
+
messages.info(
|
|
308
|
+
request, "This page is currently under construction.", extra_tags="safe"
|
|
309
|
+
)
|
|
310
|
+
return render(
|
|
311
|
+
request,
|
|
312
|
+
"portal/ten_year_map.html",
|
|
313
|
+
{"BANNER": TEN_YEAR_MAP_BANNER, "HEADLINE": TEN_YEAR_MAP_HEADLINE},
|
|
314
|
+
)
|
|
270
315
|
|
|
271
316
|
|
|
272
317
|
def reset_screentime_warning(request):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|