codeforlife-portal 8.4.0__py2.py3-none-any.whl → 8.4.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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codeforlife-portal
3
- Version: 8.4.0
3
+ Version: 8.4.1
4
4
  Classifier: Programming Language :: Python
5
5
  Classifier: Programming Language :: Python :: 3.12
6
6
  Classifier: Framework :: Django
@@ -111,7 +111,7 @@ example_project/portal_test_settings.py,sha256=mTyObCGkZEI0IQSZkqCjb1WZ7ebjQLwui
111
111
  example_project/settings.py,sha256=pHQDI_A_yXV3u1efj689tc-vPI6nBFma4gMMPBzj0aI,5652
112
112
  example_project/urls.py,sha256=FUTzHPlUS1O5kqMHjL5V4L552N2ln7uTDXcw9wjKUto,422
113
113
  example_project/wsgi.py,sha256=U1W6WzZxZaIdYZ5tks7w9fqp5WS5qvn2iThsVcskrWw,829
114
- portal/__init__.py,sha256=ewV4OXfRKUnA7PPA-m0T-EIAUCBmvPUrtesvVXFrkWA,22
114
+ portal/__init__.py,sha256=6yCd3vhnQem22chqsom8x3AUg4DeTLyaMeAcm2HpMtk,22
115
115
  portal/admin.py,sha256=RKJizTF6dPJKmGPZw7nZUM0X8jkiTjgyKhLQxtvHJ0I,6148
116
116
  portal/app_settings.py,sha256=DhWLQOwM0zVOXE3O5TNKbMM9K6agfLuCsHOdr1J7xEI,651
117
117
  portal/backends.py,sha256=2Dss6_WoQwPuDzJUF1yEaTQTNG4eUrD12ujJQ5cp5Tc,812
@@ -119,7 +119,7 @@ portal/beta.py,sha256=0TCC-9_KZoM1nuzJ9FiuKR5n9JITdMYenHGQtRvn9UU,255
119
119
  portal/context_processors.py,sha256=1TrUZqnMqGa5f7ERph9EpBqojSMJvOrcpnJzTdeCLDI,133
120
120
  portal/handlers.py,sha256=gF99OfQrGcIGDnUyONhvylZNU8sl6XHYEurwu0fuiss,422
121
121
  portal/models.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
- portal/urls.py,sha256=LFSumASmTGjFciMcc6OEFvJ1MWgFUS5wNRugGWON40E,18211
122
+ portal/urls.py,sha256=BWhRI-9rGEydbasI0UCtYYASqHbyUXokfepNWty7cQg,18218
123
123
  portal/wsgi.py,sha256=3yRcNxBQG30NhzrVi93bX-DrbXtsIQBc70HiW5wbOyE,401
124
124
  portal/forms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
125
125
  portal/forms/admin.py,sha256=Cdl8-wvasAzvMfgUlFYzQjYeuyC7gIsSiy8V_-jMp7w,2080
@@ -611,6 +611,7 @@ portal/views/admin.py,sha256=4Xt3zEyQH7sUwQSrwuRtoCodWidjOzd7gJUwWU96pXY,957
611
611
  portal/views/api.py,sha256=mdWmFkV5mxmR-mvj6ttIe8uwW9tbcx9-5ykk5dpX0LI,7047
612
612
  portal/views/dotmailer.py,sha256=OH06IXuqqjhQbEie8g8y2ZY1oZvsCtNHhkQRLa-julg,2467
613
613
  portal/views/email.py,sha256=V3wXRxIjeZ4OJBVqGCQrPn-GQWKZK1PCXbR1f2Zpa_4,2174
614
+ portal/views/google_analytics.py,sha256=cbNq9apCVpjoXCdovjrwo2jshWu5tUOItB-fTr-losw,769
614
615
  portal/views/home.py,sha256=8leK4ADxRg-gK-bm7D08CR44bhV3I8lt5pCV59HXMkk,9619
615
616
  portal/views/legal.py,sha256=yarJgxmr0q2Bn5TAKfBdVdxc964YIJN2ByG2SvY6IP0,348
616
617
  portal/views/organisation.py,sha256=sPDbiM7hdtpF8GKyh_4n4VPl2a-WnAgnF4q9aSvQCVI,3341
@@ -633,8 +634,8 @@ portal/views/two_factor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
633
634
  portal/views/two_factor/core.py,sha256=Lk32z2SN2Pg0rRkK-N-LXMvXC1kKKsH3l692kiSDQ4E,964
634
635
  portal/views/two_factor/form.py,sha256=lnHNKI-BMlpncTuW3zUzjPaJJNuEra2I_nOam0eOKFY,257
635
636
  portal/views/two_factor/profile.py,sha256=SHSg_xHccE5PtD-OfuOkYhREYz_er4bj5ro1RjJ88Yw,393
636
- codeforlife_portal-8.4.0.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
637
- codeforlife_portal-8.4.0.dist-info/METADATA,sha256=RgNIvNFEU6FeacWj4ytgtwoQ9ewiLbCg89uuCN2lJ_k,3077
638
- codeforlife_portal-8.4.0.dist-info/WHEEL,sha256=WDDPHYzpiOIm6GP1C2_8y8W6q16ICddAgOHlhTje9Qc,109
639
- codeforlife_portal-8.4.0.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
640
- codeforlife_portal-8.4.0.dist-info/RECORD,,
637
+ codeforlife_portal-8.4.1.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
638
+ codeforlife_portal-8.4.1.dist-info/METADATA,sha256=bU_r6aXVNL0xdvKY25Bd42t6lWnJuswz2NejKBwUb9w,3077
639
+ codeforlife_portal-8.4.1.dist-info/WHEEL,sha256=WDDPHYzpiOIm6GP1C2_8y8W6q16ICddAgOHlhTje9Qc,109
640
+ codeforlife_portal-8.4.1.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
641
+ codeforlife_portal-8.4.1.dist-info/RECORD,,
portal/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.4.0"
1
+ __version__ = "8.4.1"
portal/urls.py CHANGED
@@ -21,12 +21,9 @@ from portal.helpers.ratelimit import (
21
21
  school_student_key,
22
22
  )
23
23
  from portal.helpers.regexes import ACCESS_CODE_REGEX, JWT_REGEX
24
- from portal.views import cron
24
+ from portal.views import cron, google_analytics
25
25
  from portal.views.about import about, contribute, getinvolved
26
- from portal.views.admin import (
27
- AdminChangePasswordDoneView,
28
- AdminChangePasswordView,
29
- )
26
+ from portal.views.admin import AdminChangePasswordDoneView, AdminChangePasswordView
30
27
  from portal.views.api import (
31
28
  AnonymiseOrphanSchoolsView,
32
29
  InactiveUsersView,
@@ -35,10 +32,7 @@ from portal.views.api import (
35
32
  number_users_per_country,
36
33
  registered_users,
37
34
  )
38
- from portal.views.dotmailer import (
39
- dotmailer_consent_form,
40
- process_newsletter_form,
41
- )
35
+ from portal.views.dotmailer import dotmailer_consent_form, process_newsletter_form
42
36
  from portal.views.email import verify_email
43
37
  from portal.views.home import (
44
38
  coding_club,
@@ -111,12 +105,8 @@ from portal.views.two_factor.profile import CustomDisableView
111
105
  js_info_dict = {"packages": ("conf.locale",)}
112
106
 
113
107
  two_factor_patterns = [
114
- re_path(
115
- r"^account/two_factor/setup/$", CustomSetupView.as_view(), name="setup"
116
- ),
117
- re_path(
118
- r"^account/two_factor/qrcode/$", QRGeneratorView.as_view(), name="qr"
119
- ),
108
+ re_path(r"^account/two_factor/setup/$", CustomSetupView.as_view(), name="setup"),
109
+ re_path(r"^account/two_factor/qrcode/$", QRGeneratorView.as_view(), name="qr"),
120
110
  re_path(
121
111
  r"^account/two_factor/setup/complete/$",
122
112
  SetupCompleteView.as_view(),
@@ -141,6 +131,11 @@ two_factor_patterns = [
141
131
 
142
132
 
143
133
  urlpatterns = [
134
+ path(
135
+ "google-analytics/collect/",
136
+ google_analytics.collect,
137
+ name="collect-google-analytics",
138
+ ),
144
139
  path(
145
140
  "cron/",
146
141
  include(
@@ -187,9 +182,7 @@ urlpatterns = [
187
182
  ),
188
183
  re_path(
189
184
  r"^favicon\.ico$",
190
- RedirectView.as_view(
191
- url="/static/portal/img/favicon.ico", permanent=True
192
- ),
185
+ RedirectView.as_view(url="/static/portal/img/favicon.ico", permanent=True),
193
186
  ),
194
187
  re_path(
195
188
  r"^administration/password_change/$",
@@ -201,9 +194,7 @@ urlpatterns = [
201
194
  AdminChangePasswordDoneView.as_view(),
202
195
  name="administration_password_change_done",
203
196
  ),
204
- re_path(
205
- r"^users/inactive/", InactiveUsersView.as_view(), name="inactive_users"
206
- ),
197
+ re_path(r"^users/inactive/", InactiveUsersView.as_view(), name="inactive_users"),
207
198
  re_path(
208
199
  r"^locked_out/$",
209
200
  TemplateView.as_view(template_name="portal/locked_out.html"),
@@ -281,9 +272,7 @@ urlpatterns = [
281
272
  re_path(r"^consent_form/$", dotmailer_consent_form, name="consent_form"),
282
273
  re_path(
283
274
  r"^verify_email/$",
284
- TemplateView.as_view(
285
- template_name="portal/email_verification_needed.html"
286
- ),
275
+ TemplateView.as_view(template_name="portal/email_verification_needed.html"),
287
276
  name="email_verification",
288
277
  ),
289
278
  re_path(
@@ -368,9 +357,7 @@ urlpatterns = [
368
357
  IndependentStudentDashboard.as_view(),
369
358
  name="independent_student_details",
370
359
  ),
371
- re_path(
372
- r"^play/account/$", student_edit_account, name="student_edit_account"
373
- ),
360
+ re_path(r"^play/account/$", student_edit_account, name="student_edit_account"),
374
361
  re_path(
375
362
  r"^play/account/independent/$",
376
363
  ratelimit(
@@ -398,9 +385,7 @@ urlpatterns = [
398
385
  re_path(r"^contribute", contribute, name="contribute"),
399
386
  re_path(r"^terms", terms, name="terms"),
400
387
  re_path(r"^privacy-notice/$", privacy_notice, name="privacy_notice"),
401
- re_path(
402
- r"^privacy-policy/$", privacy_notice, name="privacy_policy"
403
- ), # Keeping this to route from old URL
388
+ re_path(r"^privacy-policy/$", privacy_notice, name="privacy_policy"), # Keeping this to route from old URL
404
389
  re_path(r"^teach/dashboard/$", dashboard_manage, name="dashboard"),
405
390
  re_path(
406
391
  r"^teach/dashboard/kick/(?P<pk>[0-9]+)/$",
@@ -0,0 +1,28 @@
1
+ import json
2
+
3
+ import requests
4
+ from django.http import HttpRequest, JsonResponse
5
+ from django.views.decorators.csrf import csrf_exempt
6
+
7
+
8
+ @csrf_exempt
9
+ def collect(request: HttpRequest):
10
+ body: dict = json.loads(request.body)
11
+ measurement_id = body["measurement_id"]
12
+ api_secret = body["api_secret"]
13
+ debug = body.get("debug", False)
14
+
15
+ response = requests.post(
16
+ url=(
17
+ "https://www.google-analytics.com/debug/mp/collect"
18
+ if debug
19
+ else "https://www.google-analytics.com/mp/collect"
20
+ )
21
+ + f"?measurement_id=${measurement_id}&api_secret=${api_secret}",
22
+ json=body["payload"],
23
+ )
24
+
25
+ return JsonResponse(
26
+ data=response.json() if debug else {},
27
+ status=response.status_code,
28
+ )