codeforlife-portal 6.44.0__py2.py3-none-any.whl → 6.44.2__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/0051_verify_returning_users.py +3 -1
- {codeforlife_portal-6.44.0.dist-info → codeforlife_portal-6.44.2.dist-info}/METADATA +2 -2
- {codeforlife_portal-6.44.0.dist-info → codeforlife_portal-6.44.2.dist-info}/RECORD +8 -8
- portal/__init__.py +1 -1
- portal/admin.py +75 -12
- {codeforlife_portal-6.44.0.dist-info → codeforlife_portal-6.44.2.dist-info}/LICENSE.md +0 -0
- {codeforlife_portal-6.44.0.dist-info → codeforlife_portal-6.44.2.dist-info}/WHEEL +0 -0
- {codeforlife_portal-6.44.0.dist-info → codeforlife_portal-6.44.2.dist-info}/top_level.txt +0 -0
|
@@ -14,7 +14,9 @@ def verify_returning_users(apps: Apps, *args):
|
|
|
14
14
|
user__last_login__isnull=False, is_verified=False
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
-
for
|
|
17
|
+
for (
|
|
18
|
+
unverified_returning_userprofile
|
|
19
|
+
) in unverified_returning_userprofiles.iterator(chunk_size=1000):
|
|
18
20
|
unverified_returning_userprofile.is_verified = True
|
|
19
21
|
unverified_returning_userprofile.save()
|
|
20
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: codeforlife-portal
|
|
3
|
-
Version: 6.44.
|
|
3
|
+
Version: 6.44.2
|
|
4
4
|
Classifier: Programming Language :: Python
|
|
5
5
|
Classifier: Programming Language :: Python :: 3.8
|
|
6
6
|
Classifier: Framework :: Django
|
|
@@ -24,7 +24,7 @@ Requires-Dist: django-classy-tags ==2.0.0
|
|
|
24
24
|
Requires-Dist: libsass ==0.23.0
|
|
25
25
|
Requires-Dist: phonenumbers ==8.12.12
|
|
26
26
|
Requires-Dist: more-itertools ==8.7.0
|
|
27
|
-
Requires-Dist: cfl-common ==6.44.
|
|
27
|
+
Requires-Dist: cfl-common ==6.44.2
|
|
28
28
|
Requires-Dist: django-ratelimit ==3.0.1
|
|
29
29
|
Requires-Dist: django-preventconcurrentlogins ==0.8.2
|
|
30
30
|
Requires-Dist: django-csp ==3.7
|
|
@@ -64,7 +64,7 @@ cfl_common/common/migrations/0047_delete_school_postcode.py,sha256=GPV0hLfXmbPpx
|
|
|
64
64
|
cfl_common/common/migrations/0048_unique_school_names.py,sha256=pu5xiuesvFNGngD-hl0OQ6Gi2r6pEY9fPCayKyb9n04,1433
|
|
65
65
|
cfl_common/common/migrations/0049_anonymise_orphan_users.py,sha256=tw9xMrDMRPDCO8HWjBVlnQF8r1YVCKZnVr2wZ3He6og,847
|
|
66
66
|
cfl_common/common/migrations/0050_anonymise_orphan_schools.py,sha256=_KCkSkoObTpLplX6gXvlV3JXpddn7neyJEa8YKFWeW0,869
|
|
67
|
-
cfl_common/common/migrations/0051_verify_returning_users.py,sha256=
|
|
67
|
+
cfl_common/common/migrations/0051_verify_returning_users.py,sha256=TI-wllQ2OSG56eUYatp5W7tZZcnw0UHPJCDIs4G_REQ,999
|
|
68
68
|
cfl_common/common/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
69
69
|
cfl_common/common/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
70
70
|
cfl_common/common/tests/test_migration_aimmo_characters.py,sha256=pdCCsns90Qz05QqmaBUYK18jKe9aP-symtZjkKG4rag,1079
|
|
@@ -105,8 +105,8 @@ example_project/portal_test_settings.py,sha256=frp_XMpd-z1g3VFCRxB2w7AaFW2ivRVKn
|
|
|
105
105
|
example_project/settings.py,sha256=XRZZvASoIl5a9xe3masTq_CUBleuJq9ByHx8f_e2UFc,5613
|
|
106
106
|
example_project/urls.py,sha256=OVeRQ-TCpzHISBRuzqD0yd3ewF7H5U3c-f2p2alfUD0,430
|
|
107
107
|
example_project/wsgi.py,sha256=U1W6WzZxZaIdYZ5tks7w9fqp5WS5qvn2iThsVcskrWw,829
|
|
108
|
-
portal/__init__.py,sha256=
|
|
109
|
-
portal/admin.py,sha256=
|
|
108
|
+
portal/__init__.py,sha256=OVxkfOV4_cLnh0dP0fyYbwDlVQG1uti8-QYSVsVaDQw,23
|
|
109
|
+
portal/admin.py,sha256=on1-zNRnZvf2cwBN6GVRVYRhkaksrCgfzX8XPWtkvz8,6062
|
|
110
110
|
portal/app_settings.py,sha256=DhWLQOwM0zVOXE3O5TNKbMM9K6agfLuCsHOdr1J7xEI,651
|
|
111
111
|
portal/backends.py,sha256=2Dss6_WoQwPuDzJUF1yEaTQTNG4eUrD12ujJQ5cp5Tc,812
|
|
112
112
|
portal/beta.py,sha256=0TCC-9_KZoM1nuzJ9FiuKR5n9JITdMYenHGQtRvn9UU,255
|
|
@@ -642,8 +642,8 @@ portal/views/two_factor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
642
642
|
portal/views/two_factor/core.py,sha256=O_wcBeFqdPYSGNGv-pT_vbs5-Dj1Z-Jfkd6f9-E5yZI,760
|
|
643
643
|
portal/views/two_factor/form.py,sha256=lnHNKI-BMlpncTuW3zUzjPaJJNuEra2I_nOam0eOKFY,257
|
|
644
644
|
portal/views/two_factor/profile.py,sha256=tkl_ludo8arMtd5LKNmohM66vpC_YQiP-0nspTSJiJ4,383
|
|
645
|
-
codeforlife_portal-6.44.
|
|
646
|
-
codeforlife_portal-6.44.
|
|
647
|
-
codeforlife_portal-6.44.
|
|
648
|
-
codeforlife_portal-6.44.
|
|
649
|
-
codeforlife_portal-6.44.
|
|
645
|
+
codeforlife_portal-6.44.2.dist-info/LICENSE.md,sha256=9AbRlCDqD2D1tPibimysFv3zg3AIc49-eyv9aEsyq9w,115
|
|
646
|
+
codeforlife_portal-6.44.2.dist-info/METADATA,sha256=x65imK3Q0-BmSMarM_nCFTcL6pgoCxlrpFxq7V8zVAI,1137
|
|
647
|
+
codeforlife_portal-6.44.2.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
648
|
+
codeforlife_portal-6.44.2.dist-info/top_level.txt,sha256=8e5pdsuIoTqEAMqpelHBjGjLbffcBtgOoggmd2q7nMw,41
|
|
649
|
+
codeforlife_portal-6.44.2.dist-info/RECORD,,
|
portal/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "6.44.
|
|
1
|
+
__version__ = "6.44.2"
|
portal/admin.py
CHANGED
|
@@ -17,23 +17,46 @@ from django.contrib.auth.models import User
|
|
|
17
17
|
from django.http import HttpResponse
|
|
18
18
|
from import_export.admin import ExportActionMixin
|
|
19
19
|
|
|
20
|
-
from portal.forms.admin import
|
|
20
|
+
from portal.forms.admin import (
|
|
21
|
+
AdminChangeUserPasswordForm,
|
|
22
|
+
AdminUserCreationForm,
|
|
23
|
+
)
|
|
21
24
|
from portal.views.api import anonymise
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
class ClassAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
25
|
-
search_fields = [
|
|
26
|
-
|
|
28
|
+
search_fields = [
|
|
29
|
+
"name",
|
|
30
|
+
"teacher__new_user__first_name",
|
|
31
|
+
"teacher__new_user__last_name",
|
|
32
|
+
"teacher__school__name",
|
|
33
|
+
]
|
|
34
|
+
list_display = [
|
|
35
|
+
"__str__",
|
|
36
|
+
"teacher",
|
|
37
|
+
"teacher_school",
|
|
38
|
+
"number_of_students",
|
|
39
|
+
"id",
|
|
40
|
+
]
|
|
27
41
|
autocomplete_fields = ["teacher"]
|
|
28
42
|
|
|
29
43
|
def teacher_school(self, obj):
|
|
30
44
|
return obj.teacher.school
|
|
31
45
|
|
|
46
|
+
def number_of_students(self, obj):
|
|
47
|
+
return len(obj.students.all())
|
|
48
|
+
|
|
32
49
|
|
|
33
50
|
class SchoolAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
34
51
|
search_fields = ["name", "country", "county"]
|
|
35
52
|
list_filter = ["county", "country"]
|
|
36
|
-
list_display = [
|
|
53
|
+
list_display = [
|
|
54
|
+
"__str__",
|
|
55
|
+
"country",
|
|
56
|
+
"county",
|
|
57
|
+
"number_of_teachers",
|
|
58
|
+
"number_of_classes",
|
|
59
|
+
]
|
|
37
60
|
|
|
38
61
|
def number_of_teachers(self, obj):
|
|
39
62
|
return len(obj.teacher_school.all())
|
|
@@ -52,7 +75,13 @@ class StudentAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
|
52
75
|
"class_field__teacher__new_user__last_name",
|
|
53
76
|
"class_field__teacher__school__name",
|
|
54
77
|
]
|
|
55
|
-
list_display = [
|
|
78
|
+
list_display = [
|
|
79
|
+
"__str__",
|
|
80
|
+
"class_field",
|
|
81
|
+
"class_field_teacher",
|
|
82
|
+
"class_field_school",
|
|
83
|
+
"new_user",
|
|
84
|
+
]
|
|
56
85
|
readonly_fields = ["user", "new_user", "login_id"]
|
|
57
86
|
autocomplete_fields = ["class_field", "pending_class_request"]
|
|
58
87
|
|
|
@@ -70,18 +99,45 @@ class StudentAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
|
70
99
|
|
|
71
100
|
|
|
72
101
|
class TeacherAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
73
|
-
search_fields = [
|
|
74
|
-
|
|
102
|
+
search_fields = [
|
|
103
|
+
"new_user__first_name",
|
|
104
|
+
"new_user__last_name",
|
|
105
|
+
"school__name",
|
|
106
|
+
"new_user__username",
|
|
107
|
+
]
|
|
108
|
+
list_display = [
|
|
109
|
+
"__str__",
|
|
110
|
+
"school",
|
|
111
|
+
"new_user",
|
|
112
|
+
"number_of_classes",
|
|
113
|
+
"is_admin",
|
|
114
|
+
]
|
|
75
115
|
readonly_fields = ["user", "new_user"]
|
|
76
116
|
autocomplete_fields = ["school", "invited_by"]
|
|
77
117
|
|
|
118
|
+
def number_of_classes(self, obj):
|
|
119
|
+
return len(obj.class_teacher.all())
|
|
120
|
+
|
|
78
121
|
|
|
79
122
|
class UserProfileAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
80
|
-
search_fields = [
|
|
123
|
+
search_fields = [
|
|
124
|
+
"id",
|
|
125
|
+
"user__first_name",
|
|
126
|
+
"user__last_name",
|
|
127
|
+
"user__username",
|
|
128
|
+
"user__date_joined",
|
|
129
|
+
]
|
|
81
130
|
list_filter = ["user__date_joined"]
|
|
82
|
-
list_display = ["user", "__str__", "is_verified"]
|
|
131
|
+
list_display = ["user", "__str__", "is_verified", "type", "id"]
|
|
83
132
|
readonly_fields = ["user"]
|
|
84
133
|
|
|
134
|
+
def type(self, obj):
|
|
135
|
+
if hasattr(obj, "student"):
|
|
136
|
+
if obj.student.class_field is None:
|
|
137
|
+
return "INDEPENDENT"
|
|
138
|
+
return "STUDENT"
|
|
139
|
+
return "TEACHER"
|
|
140
|
+
|
|
85
141
|
|
|
86
142
|
class SchoolTeacherInvitationAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
87
143
|
search_fields = [
|
|
@@ -103,6 +159,11 @@ class DynamicElementAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
|
103
159
|
return False
|
|
104
160
|
|
|
105
161
|
|
|
162
|
+
class DailyActivityAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
163
|
+
search_fields = ["date"]
|
|
164
|
+
list_display = ["__str__", "date"]
|
|
165
|
+
|
|
166
|
+
|
|
106
167
|
class TotalActivityAdmin(admin.ModelAdmin, ExportActionMixin):
|
|
107
168
|
def has_add_permission(self, request):
|
|
108
169
|
return False
|
|
@@ -118,7 +179,9 @@ def anonymise_user(user_admin, request, queryset):
|
|
|
118
179
|
|
|
119
180
|
def export_as_csv(self, request, queryset):
|
|
120
181
|
meta = self.model._meta
|
|
121
|
-
field_names = [
|
|
182
|
+
field_names = [
|
|
183
|
+
field.name for field in meta.fields if field.name != "password"
|
|
184
|
+
]
|
|
122
185
|
|
|
123
186
|
response = HttpResponse(content_type="text/csv")
|
|
124
187
|
response["Content-Disposition"] = "attachment; filename={}.csv".format(meta)
|
|
@@ -135,7 +198,7 @@ anonymise_user.short_description = "Anonymise selected users"
|
|
|
135
198
|
export_as_csv.short_description = "Export selected users data as CSV"
|
|
136
199
|
|
|
137
200
|
|
|
138
|
-
UserAdmin.list_display += ("date_joined",)
|
|
201
|
+
UserAdmin.list_display += ("date_joined", "id")
|
|
139
202
|
UserAdmin.list_filter += ("date_joined",)
|
|
140
203
|
UserAdmin.add_form = AdminUserCreationForm
|
|
141
204
|
UserAdmin.change_password_form = AdminChangeUserPasswordForm
|
|
@@ -152,5 +215,5 @@ admin.site.register(User, UserAdmin)
|
|
|
152
215
|
admin.site.register(UserProfile, UserProfileAdmin)
|
|
153
216
|
admin.site.register(SchoolTeacherInvitation, SchoolTeacherInvitationAdmin)
|
|
154
217
|
admin.site.register(DynamicElement, DynamicElementAdmin)
|
|
155
|
-
admin.site.register(DailyActivity)
|
|
218
|
+
admin.site.register(DailyActivity, DailyActivityAdmin)
|
|
156
219
|
admin.site.register(TotalActivity, TotalActivityAdmin)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|