codeforlife-portal 8.0.6__py2.py3-none-any.whl → 8.0.7__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.

@@ -0,0 +1,25 @@
1
+ from django.apps.registry import Apps
2
+ from django.db import migrations
3
+
4
+
5
+ def set_non_school_teachers_as_non_admins(apps: Apps, *args):
6
+ Teacher = apps.get_model("common", "Teacher")
7
+
8
+ Teacher.objects.filter(
9
+ is_admin=True,
10
+ school__isnull=True,
11
+ ).update(is_admin=False)
12
+
13
+
14
+ class Migration(migrations.Migration):
15
+
16
+ dependencies = [
17
+ ("common", "0055_alter_schoolteacherinvitation_token"),
18
+ ]
19
+
20
+ operations = [
21
+ migrations.RunPython(
22
+ code=set_non_school_teachers_as_non_admins,
23
+ reverse_code=migrations.RunPython.noop,
24
+ ),
25
+ ]
@@ -0,0 +1,19 @@
1
+ # Generated by Django 4.2.17 on 2025-01-13 17:34
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("common", "0056_set_non_school_teachers_as_non_admins"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AddConstraint(
14
+ model_name="teacher",
15
+ constraint=models.CheckConstraint(
16
+ check=models.Q(("is_admin", True), ("school__isnull", True), _negated=True), name="teacher__is_admin"
17
+ ),
18
+ ),
19
+ ]
@@ -126,6 +126,17 @@ class Teacher(models.Model):
126
126
 
127
127
  objects = TeacherModelManager()
128
128
 
129
+ class Meta:
130
+ constraints = [
131
+ models.CheckConstraint(
132
+ check=~models.Q(
133
+ school__isnull=True,
134
+ is_admin=True,
135
+ ),
136
+ name="teacher__is_admin",
137
+ )
138
+ ]
139
+
129
140
  def teaches(self, userprofile):
130
141
  if hasattr(userprofile, "student"):
131
142
  student = userprofile.student
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codeforlife-portal
3
- Version: 8.0.6
3
+ Version: 8.0.7
4
4
  Classifier: Programming Language :: Python
5
5
  Classifier: Programming Language :: Python :: 3.12
6
6
  Classifier: Framework :: Django
@@ -6,7 +6,7 @@ cfl_common/common/apps.py,sha256=49UXZ3bSkFKvIEOL4zM7y1sAhccQJyRtsoOg5XVd_8Y,129
6
6
  cfl_common/common/context_processors.py,sha256=X0iuX5qu9kMWa7q8osE9CJ2LgM7pPOYQFGdjm8X3rk0,236
7
7
  cfl_common/common/csp_config.py,sha256=9ECOLnp60ENRFAYEEIoYOMhqQzLgfKA-wkWxeUBwDrQ,2824
8
8
  cfl_common/common/mail.py,sha256=pIRfUMVoJWxdv74UqToj_0_pTVTC51z6QlFVLI3QBOw,6874
9
- cfl_common/common/models.py,sha256=bfmdqC8DPy4lq_XDvn0aWAJbNdjfaMkuXu0cHLOyWZI,15835
9
+ cfl_common/common/models.py,sha256=_uD8pIO5fGVbOD8NydJVIzpiEDAaR2hIfpOhDT6jB34,16106
10
10
  cfl_common/common/permissions.py,sha256=gC6RQGZI2QDBbglx-xr_V4Hl2C2nf1V2_uPmEuoEcJo,2416
11
11
  cfl_common/common/utils.py,sha256=Nn2Npao9Uqad5Js_IdHwF-ow6wrPNpBLW4AO1LxoEBc,1727
12
12
  cfl_common/common/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -69,6 +69,8 @@ cfl_common/common/migrations/0052_add_cse_fields.py,sha256=NhUkkcu2EBzJFhewCTccQ
69
69
  cfl_common/common/migrations/0053_clean_class_data.py,sha256=lBKlDa49YwT660o-Ot6IYe4I1KfervTn4uAijda0nyw,584
70
70
  cfl_common/common/migrations/0054_delete_aimmo_models.py,sha256=fmn4mDdlHr5DhPbIl_ygvGwWVFD8TZHAgQ6VUQQgCx8,415
71
71
  cfl_common/common/migrations/0055_alter_schoolteacherinvitation_token.py,sha256=lzPAMaI3zU_q25RuIos_LV97NXOa3MIn_eWaEL71Y4I,403
72
+ cfl_common/common/migrations/0056_set_non_school_teachers_as_non_admins.py,sha256=_BrC9yfSYpP-c7EGFZmz8a4Kx_SxnRhpLMxJ70RVFOY,603
73
+ cfl_common/common/migrations/0057_teacher_teacher__is_admin.py,sha256=4pinm9T3JF3PRNLnbXI6mdFiNyxg1MnRs8lMKC4S5Bc,511
72
74
  cfl_common/common/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
75
  cfl_common/common/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
76
  cfl_common/common/tests/test_migration_anonymise_orphan_schools.py,sha256=wJRyPgRvBsXLSCFdbBi2GXjgSgDbKUTRiM31CXIvpqs,1194
@@ -108,7 +110,7 @@ example_project/portal_test_settings.py,sha256=7Q7SdosA0Ba85qz-xkAe3EHyMPpSIQ61C
108
110
  example_project/settings.py,sha256=NjFhtDNLwdY5vhUAtqk9a9m3GRfcuWRVqIqnJ3u0o6E,5658
109
111
  example_project/urls.py,sha256=FUTzHPlUS1O5kqMHjL5V4L552N2ln7uTDXcw9wjKUto,422
110
112
  example_project/wsgi.py,sha256=U1W6WzZxZaIdYZ5tks7w9fqp5WS5qvn2iThsVcskrWw,829
111
- portal/__init__.py,sha256=0UVFH05U_SSITAGCT0SSjcWSJnwORBaDn5ZSlvquMo8,22
113
+ portal/__init__.py,sha256=R91ZhDdp1RFN8qHzUX8g2PziduG-lxKY1L7jJUsoLAI,22
112
114
  portal/admin.py,sha256=RKJizTF6dPJKmGPZw7nZUM0X8jkiTjgyKhLQxtvHJ0I,6148
113
115
  portal/app_settings.py,sha256=DhWLQOwM0zVOXE3O5TNKbMM9K6agfLuCsHOdr1J7xEI,651
114
116
  portal/backends.py,sha256=2Dss6_WoQwPuDzJUF1yEaTQTNG4eUrD12ujJQ5cp5Tc,812
@@ -631,8 +633,8 @@ portal/views/two_factor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
631
633
  portal/views/two_factor/core.py,sha256=Lk32z2SN2Pg0rRkK-N-LXMvXC1kKKsH3l692kiSDQ4E,964
632
634
  portal/views/two_factor/form.py,sha256=lnHNKI-BMlpncTuW3zUzjPaJJNuEra2I_nOam0eOKFY,257
633
635
  portal/views/two_factor/profile.py,sha256=SHSg_xHccE5PtD-OfuOkYhREYz_er4bj5ro1RjJ88Yw,393
634
- codeforlife_portal-8.0.6.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
635
- codeforlife_portal-8.0.6.dist-info/METADATA,sha256=LqAmHU3joCyAWs22hLvrVW4Y5r_QcFZQcHyUVfyIIIc,3078
636
- codeforlife_portal-8.0.6.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
637
- codeforlife_portal-8.0.6.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
638
- codeforlife_portal-8.0.6.dist-info/RECORD,,
636
+ codeforlife_portal-8.0.7.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
637
+ codeforlife_portal-8.0.7.dist-info/METADATA,sha256=TcnjGRqnNqZjCzDzOsu-hzwLjRP0tmk1javSVcyEbMI,3078
638
+ codeforlife_portal-8.0.7.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
639
+ codeforlife_portal-8.0.7.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
640
+ codeforlife_portal-8.0.7.dist-info/RECORD,,
portal/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "8.0.6"
1
+ __version__ = "8.0.7"