learning-credentials 0.2.0rc3__py2.py3-none-any.whl → 0.2.2rc1__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.
- learning_credentials/__init__.py +1 -1
- learning_credentials/compat.py +2 -0
- learning_credentials/generators.py +2 -1
- learning_credentials/migrations/0001_initial.py +2 -2
- learning_credentials/migrations/0002_migrate_to_learning_credentials.py +33 -25
- learning_credentials/migrations/0006_cleanup_openedx_certificates_tables.py +21 -0
- learning_credentials/models.py +3 -3
- learning_credentials/processors.py +77 -6
- learning_credentials/settings/common.py +0 -3
- {learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/METADATA +26 -6
- {learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/RECORD +15 -19
- {learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/WHEEL +1 -1
- {learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/entry_points.txt +0 -1
- {learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/top_level.txt +0 -1
- openedx_certificates/__init__.py +0 -1
- openedx_certificates/apps.py +0 -11
- openedx_certificates/migrations/0001_initial.py +0 -206
- openedx_certificates/migrations/__init__.py +0 -0
- openedx_certificates/models.py +0 -38
- {learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/licenses/LICENSE.txt +0 -0
learning_credentials/__init__.py
CHANGED
learning_credentials/compat.py
CHANGED
|
@@ -5,6 +5,8 @@ This module moderates access to all edx-platform features allowing for cross-ver
|
|
|
5
5
|
It also simplifies running tests outside edx-platform's environment by stubbing these functions in unit tests.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
+
# ruff: noqa: PLC0415
|
|
9
|
+
|
|
8
10
|
from __future__ import annotations
|
|
9
11
|
|
|
10
12
|
from contextlib import contextmanager
|
|
@@ -98,7 +98,7 @@ def _write_text_on_template(template: any, font: str, username: str, context_nam
|
|
|
98
98
|
pdf_canvas.drawString(name_x, name_y, username)
|
|
99
99
|
|
|
100
100
|
# Write the learning context name.
|
|
101
|
-
pdf_canvas.setFont(font, 28)
|
|
101
|
+
pdf_canvas.setFont(font, options.get('context_name_size', 28))
|
|
102
102
|
context_name_color = options.get('context_name_color', '#000')
|
|
103
103
|
pdf_canvas.setFillColorRGB(*hex_to_rgb(context_name_color))
|
|
104
104
|
|
|
@@ -187,6 +187,7 @@ def generate_pdf_credential(
|
|
|
187
187
|
- context_name: Specify the custom course or Learning Path name.
|
|
188
188
|
- context_name_y: The Y coordinate of the context name on the credential (vertical position on the template).
|
|
189
189
|
- context_name_color: The color of the context name on the credential (hexadecimal color code).
|
|
190
|
+
- context_name_size: The font size of the context name on the credential. The default value is 28.
|
|
190
191
|
- issue_date_y: The Y coordinate of the issue date on the credential (vertical position on the template).
|
|
191
192
|
- issue_date_color: The color of the issue date on the credential (hexadecimal color code).
|
|
192
193
|
"""
|
|
@@ -5,7 +5,7 @@ import model_utils.fields
|
|
|
5
5
|
import opaque_keys.edx.django.models
|
|
6
6
|
import uuid
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import learning_credentials.models
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class Migration(migrations.Migration):
|
|
@@ -39,7 +39,7 @@ class Migration(migrations.Migration):
|
|
|
39
39
|
models.FileField(
|
|
40
40
|
help_text='Asset file. It could be a PDF template, image or font file.',
|
|
41
41
|
max_length=255,
|
|
42
|
-
upload_to=
|
|
42
|
+
upload_to=learning_credentials.models.CredentialAsset.template_assets_path,
|
|
43
43
|
),
|
|
44
44
|
),
|
|
45
45
|
(
|
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
from django.db import migrations
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
def migrate_data_if_tables_exist(apps, schema_editor):
|
|
5
|
+
"""Migrate data from openedx_certificates to learning_credentials tables if the source tables exist."""
|
|
6
|
+
connection = schema_editor.connection
|
|
7
|
+
cursor = connection.cursor()
|
|
8
|
+
table_names = connection.introspection.table_names(cursor)
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
tables_to_migrate = [
|
|
11
|
+
(
|
|
12
|
+
"openedx_certificates_externalcertificatetype",
|
|
13
|
+
"learning_credentials_externalcertificatetype",
|
|
14
|
+
"id, created, modified, name, retrieval_func, generation_func, custom_options",
|
|
15
|
+
),
|
|
16
|
+
(
|
|
17
|
+
"openedx_certificates_externalcertificatecourseconfiguration",
|
|
18
|
+
"learning_credentials_externalcertificatecourseconfiguration",
|
|
19
|
+
"id, created, modified, course_id, custom_options, certificate_type_id, periodic_task_id",
|
|
20
|
+
),
|
|
21
|
+
(
|
|
22
|
+
"openedx_certificates_externalcertificateasset",
|
|
23
|
+
"learning_credentials_externalcertificateasset",
|
|
24
|
+
"id, created, modified, description, asset, asset_slug",
|
|
25
|
+
),
|
|
26
|
+
(
|
|
27
|
+
"openedx_certificates_externalcertificate",
|
|
28
|
+
"learning_credentials_externalcertificate",
|
|
29
|
+
"uuid, created, modified, user_id, user_full_name, course_id, certificate_type, status, download_url, legacy_id, generation_task_id",
|
|
30
|
+
),
|
|
31
|
+
]
|
|
15
32
|
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
for source_table, target_table, fields in tables_to_migrate:
|
|
34
|
+
if source_table in table_names:
|
|
35
|
+
cursor.execute(f"INSERT INTO {target_table} ({fields}) SELECT {fields} FROM {source_table};")
|
|
18
36
|
|
|
19
|
-
"INSERT INTO learning_credentials_externalcertificateasset (id, created, modified, description, asset, asset_slug) "
|
|
20
|
-
"SELECT id, created, modified, description, asset, asset_slug FROM openedx_certificates_externalcertificateasset;",
|
|
21
37
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
reverse_sql=[
|
|
26
|
-
"DELETE FROM learning_credentials_externalcertificate;",
|
|
27
|
-
"DELETE FROM learning_credentials_externalcertificatecourseconfiguration;",
|
|
28
|
-
"DELETE FROM learning_credentials_externalcertificateasset;",
|
|
29
|
-
"DELETE FROM learning_credentials_externalcertificatetype;",
|
|
30
|
-
],
|
|
31
|
-
),
|
|
32
|
-
]
|
|
38
|
+
class Migration(migrations.Migration):
|
|
39
|
+
dependencies = [("learning_credentials", "0001_initial")]
|
|
40
|
+
operations = [migrations.RunPython(migrate_data_if_tables_exist, migrations.RunPython.noop)]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Clean up legacy `openedx_certificates` tables.
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
("learning_credentials", "0005_rename_processors_and_generators"),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.RunSQL(
|
|
13
|
+
sql=[
|
|
14
|
+
"DROP TABLE IF EXISTS openedx_certificates_externalcertificate;",
|
|
15
|
+
"DROP TABLE IF EXISTS openedx_certificates_externalcertificateasset;",
|
|
16
|
+
"DROP TABLE IF EXISTS openedx_certificates_externalcertificatecourseconfiguration;",
|
|
17
|
+
"DROP TABLE IF EXISTS openedx_certificates_externalcertificatetype;",
|
|
18
|
+
],
|
|
19
|
+
reverse_sql=migrations.RunSQL.noop,
|
|
20
|
+
),
|
|
21
|
+
]
|
learning_credentials/models.py
CHANGED
|
@@ -106,7 +106,7 @@ class CredentialConfiguration(TimeStampedModel):
|
|
|
106
106
|
|
|
107
107
|
def save(self, *args, **kwargs):
|
|
108
108
|
"""Create a new PeriodicTask every time a new CredentialConfiguration is created."""
|
|
109
|
-
from learning_credentials.tasks import generate_credentials_for_config_task as task #
|
|
109
|
+
from learning_credentials.tasks import generate_credentials_for_config_task as task # noqa: PLC0415
|
|
110
110
|
|
|
111
111
|
# Use __wrapped__ to get the original function, as the task is wrapped by the @app.task decorator.
|
|
112
112
|
task_path = f"{task.__wrapped__.__module__}.{task.__wrapped__.__name__}"
|
|
@@ -291,7 +291,7 @@ class Credential(TimeStampedModel):
|
|
|
291
291
|
|
|
292
292
|
def send_email(self):
|
|
293
293
|
"""Send a credential link to the student."""
|
|
294
|
-
|
|
294
|
+
learning_context_name = get_learning_context_name(self.learning_context_key)
|
|
295
295
|
user = get_user_model().objects.get(id=self.user_id)
|
|
296
296
|
msg = Message(
|
|
297
297
|
name="certificate_generated",
|
|
@@ -300,7 +300,7 @@ class Credential(TimeStampedModel):
|
|
|
300
300
|
language='en',
|
|
301
301
|
context={
|
|
302
302
|
'certificate_link': self.download_url,
|
|
303
|
-
'course_name':
|
|
303
|
+
'course_name': learning_context_name,
|
|
304
304
|
'platform_name': settings.PLATFORM_NAME,
|
|
305
305
|
},
|
|
306
306
|
)
|
|
@@ -45,12 +45,14 @@ def _process_learning_context(
|
|
|
45
45
|
Process a learning context (course or learning path) using the given course processor function.
|
|
46
46
|
|
|
47
47
|
For courses, runs the processor directly. For learning paths, runs the processor on each
|
|
48
|
-
course in the path
|
|
48
|
+
course in the path with step-specific options (if available), and returns the intersection
|
|
49
|
+
of eligible users across all courses.
|
|
49
50
|
|
|
50
51
|
Args:
|
|
51
52
|
learning_context_key: A course key or learning path key to process
|
|
52
53
|
course_processor: A function that processes a single course and returns eligible user IDs
|
|
53
|
-
options: Options to pass to the processor
|
|
54
|
+
options: Options to pass to the processor. For learning paths, may contain a "steps" key
|
|
55
|
+
with step-specific options in the format: {"steps": {"<course_key>": {...}}}
|
|
54
56
|
|
|
55
57
|
Returns:
|
|
56
58
|
A list of eligible user IDs
|
|
@@ -62,12 +64,19 @@ def _process_learning_context(
|
|
|
62
64
|
|
|
63
65
|
results = None
|
|
64
66
|
for course in learning_path.steps.all():
|
|
65
|
-
|
|
67
|
+
course_options = options.get("steps", {}).get(str(course.course_key), options)
|
|
68
|
+
course_results = set(course_processor(course.course_key, course_options))
|
|
69
|
+
|
|
66
70
|
if results is None:
|
|
67
71
|
results = course_results
|
|
68
72
|
else:
|
|
69
73
|
results &= course_results
|
|
70
74
|
|
|
75
|
+
# Filter out users who are not enrolled in the Learning Path.
|
|
76
|
+
results &= set(
|
|
77
|
+
learning_path.enrolled_users.filter(learningpathenrollment__is_active=True).values_list('id', flat=True),
|
|
78
|
+
)
|
|
79
|
+
|
|
71
80
|
return list(results) if results else []
|
|
72
81
|
|
|
73
82
|
|
|
@@ -182,7 +191,7 @@ def retrieve_subsection_grades(learning_context_key: LearningContextKey, options
|
|
|
182
191
|
Options:
|
|
183
192
|
- required_grades: A dictionary of required grades for each category, where the keys are the category names and
|
|
184
193
|
the values are the minimum required grades. The grades are percentages, so they should be in the range [0, 1].
|
|
185
|
-
See the following example
|
|
194
|
+
See the following example:
|
|
186
195
|
|
|
187
196
|
{
|
|
188
197
|
"required_grades": {
|
|
@@ -200,6 +209,28 @@ def retrieve_subsection_grades(learning_context_key: LearningContextKey, options
|
|
|
200
209
|
3. Exam: 70%
|
|
201
210
|
The grades for the Total category will be calculated as follows:
|
|
202
211
|
total_grade = (homework_grade * 0.2) + (lab_grade * 0.1) + (exam_grade * 0.7)
|
|
212
|
+
- steps: For learning paths only. A dictionary with step-specific options in the format
|
|
213
|
+
{"<course_key>": {...}}. If provided, each course in the learning path will use its specific
|
|
214
|
+
options instead of the global options. Example:
|
|
215
|
+
|
|
216
|
+
{
|
|
217
|
+
"required_grades": {
|
|
218
|
+
"Total": 0.8
|
|
219
|
+
},
|
|
220
|
+
"steps": {
|
|
221
|
+
"course-v1:edX+DemoX+Demo_Course": {
|
|
222
|
+
"required_grades": {
|
|
223
|
+
"Total": 0.9
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
"course-v1:edX+CS101+2023": {
|
|
227
|
+
"required_grades": {
|
|
228
|
+
"Homework": 0.5,
|
|
229
|
+
"Total": 0.7
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
203
234
|
"""
|
|
204
235
|
return _process_learning_context(learning_context_key, _retrieve_course_subsection_grades, options)
|
|
205
236
|
|
|
@@ -240,6 +271,7 @@ def _retrieve_course_completions(course_id: CourseKey, options: dict[str, Any])
|
|
|
240
271
|
required_completion = options.get('required_completion', 0.9)
|
|
241
272
|
|
|
242
273
|
url = f'/completion-aggregator/v1/course/{course_id}/'
|
|
274
|
+
# The API supports up to 10k results per page, but we limit it to 1k to avoid performance issues.
|
|
243
275
|
query_params = {'page_size': 1000, 'page': 1}
|
|
244
276
|
|
|
245
277
|
# TODO: Extract the logic of this view into an API. The current approach is very hacky.
|
|
@@ -271,6 +303,21 @@ def retrieve_completions(learning_context_key: LearningContextKey, options: dict
|
|
|
271
303
|
|
|
272
304
|
Options:
|
|
273
305
|
- required_completion: The minimum required completion percentage. The default value is 0.9.
|
|
306
|
+
- steps: For learning paths only. A dictionary with step-specific options in the format
|
|
307
|
+
{"<course_key>": {...}}. If provided, each course in the learning path will use its specific
|
|
308
|
+
options instead of the global options. Example:
|
|
309
|
+
|
|
310
|
+
{
|
|
311
|
+
"required_completion": 0.8,
|
|
312
|
+
"steps": {
|
|
313
|
+
"course-v1:edX+DemoX+Demo_Course": {
|
|
314
|
+
"required_completion": 0.9
|
|
315
|
+
},
|
|
316
|
+
"course-v1:edX+CS101+2023": {
|
|
317
|
+
"required_completion": 0.7
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
274
321
|
"""
|
|
275
322
|
return _process_learning_context(learning_context_key, _retrieve_course_completions, options)
|
|
276
323
|
|
|
@@ -289,8 +336,7 @@ def retrieve_completions_and_grades(learning_context_key: LearningContextKey, op
|
|
|
289
336
|
Options:
|
|
290
337
|
- required_completion: The minimum required completion percentage (default: 0.9)
|
|
291
338
|
- required_grades: A dictionary of required grades for each category, where the keys are the category names and
|
|
292
|
-
the values are the minimum required grades. The grades are percentages in the range [0, 1].
|
|
293
|
-
Example::
|
|
339
|
+
the values are the minimum required grades. The grades are percentages in the range [0, 1]. Example:
|
|
294
340
|
|
|
295
341
|
{
|
|
296
342
|
"required_grades": {
|
|
@@ -299,6 +345,31 @@ def retrieve_completions_and_grades(learning_context_key: LearningContextKey, op
|
|
|
299
345
|
"Total": 0.8
|
|
300
346
|
}
|
|
301
347
|
}
|
|
348
|
+
- steps: For learning paths only. A dictionary with step-specific options in the format
|
|
349
|
+
{"<course_key>": {...}}. If provided, each course in the learning path will use its specific
|
|
350
|
+
options instead of the global options. Example:
|
|
351
|
+
|
|
352
|
+
{
|
|
353
|
+
"required_completion": 0.8,
|
|
354
|
+
"required_grades": {
|
|
355
|
+
"Total": 0.7
|
|
356
|
+
},
|
|
357
|
+
"steps": {
|
|
358
|
+
"course-v1:edX+DemoX+Demo_Course": {
|
|
359
|
+
"required_completion": 0.9,
|
|
360
|
+
"required_grades": {
|
|
361
|
+
"Total": 0.8
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"course-v1:edX+CS101+2023": {
|
|
365
|
+
"required_completion": 0.7,
|
|
366
|
+
"required_grades": {
|
|
367
|
+
"Homework": 0.5,
|
|
368
|
+
"Total": 0.6
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
302
373
|
"""
|
|
303
374
|
completion_eligible_users = set(retrieve_completions(learning_context_key, options))
|
|
304
375
|
grades_eligible_users = set(retrieve_subsection_grades(learning_context_key, options))
|
|
@@ -7,6 +7,3 @@ def plugin_settings(settings: Settings):
|
|
|
7
7
|
"""Add `django_celery_beat` to `INSTALLED_APPS`."""
|
|
8
8
|
if 'django_celery_beat' not in settings.INSTALLED_APPS:
|
|
9
9
|
settings.INSTALLED_APPS += ('django_celery_beat',)
|
|
10
|
-
# Temporary app to handle migrations.
|
|
11
|
-
if 'openedx_certificates' not in settings.INSTALLED_APPS:
|
|
12
|
-
settings.INSTALLED_APPS += ('openedx_certificates',)
|
{learning_credentials-0.2.0rc3.dist-info → learning_credentials-0.2.2rc1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: learning-credentials
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2rc1
|
|
4
4
|
Summary: A pluggable service for preparing Open edX credentials.
|
|
5
5
|
Home-page: https://github.com/open-craft/learning-credentials
|
|
6
6
|
Author: OpenCraft
|
|
@@ -28,7 +28,7 @@ Requires-Dist: django_reverse_admin
|
|
|
28
28
|
Requires-Dist: djangorestframework
|
|
29
29
|
Requires-Dist: edx-opaque-keys
|
|
30
30
|
Requires-Dist: edx_ace
|
|
31
|
-
Requires-Dist: learning-paths-plugin
|
|
31
|
+
Requires-Dist: learning-paths-plugin>=0.3.4
|
|
32
32
|
Requires-Dist: openedx-completion-aggregator
|
|
33
33
|
Requires-Dist: pypdf
|
|
34
34
|
Requires-Dist: reportlab
|
|
@@ -139,7 +139,7 @@ Please do not report security issues in public. Please email security@openedx.or
|
|
|
139
139
|
:target: https://pypi.python.org/pypi/learning-credentials/
|
|
140
140
|
:alt: PyPI
|
|
141
141
|
|
|
142
|
-
.. |ci-badge| image:: https://github.com/open-craft/learning-credentials/workflows/
|
|
142
|
+
.. |ci-badge| image:: https://github.com/open-craft/learning-credentials/actions/workflows/ci.yml/badge.svg?branch=main
|
|
143
143
|
:target: https://github.com/open-craft/learning-credentials/actions
|
|
144
144
|
:alt: CI
|
|
145
145
|
|
|
@@ -159,7 +159,7 @@ Please do not report security issues in public. Please email security@openedx.or
|
|
|
159
159
|
:target: https://github.com/open-craft/learning-credentials/blob/main/LICENSE.txt
|
|
160
160
|
:alt: License
|
|
161
161
|
|
|
162
|
-
.. |status-badge| image:: https://img.shields.io/badge/Status-
|
|
162
|
+
.. |status-badge| image:: https://img.shields.io/badge/Status-Maintained-brightgreen
|
|
163
163
|
:alt: Status
|
|
164
164
|
|
|
165
165
|
.. https://githubnext.com/projects/repo-visualization/
|
|
@@ -186,13 +186,33 @@ Unreleased
|
|
|
186
186
|
|
|
187
187
|
*
|
|
188
188
|
|
|
189
|
-
0.2.
|
|
189
|
+
0.2.2 - 2025-08-05
|
|
190
|
+
|
|
191
|
+
Added
|
|
192
|
+
=====
|
|
193
|
+
|
|
194
|
+
* Step-specific options support for Learning Path credentials.
|
|
195
|
+
|
|
196
|
+
Removed
|
|
197
|
+
=======
|
|
198
|
+
|
|
199
|
+
* Legacy `openedx_certificates` app.
|
|
200
|
+
|
|
201
|
+
0.2.1 – 2025-05-05
|
|
202
|
+
******************
|
|
203
|
+
|
|
204
|
+
Fixed
|
|
205
|
+
=====
|
|
206
|
+
|
|
207
|
+
* Check enrollment status before issuing Learning Path credentials.
|
|
208
|
+
|
|
209
|
+
0.2.0 – 2025-04-03
|
|
190
210
|
******************
|
|
191
211
|
|
|
192
212
|
Added
|
|
193
213
|
=====
|
|
194
214
|
|
|
195
|
-
*
|
|
215
|
+
* Learning Paths support.
|
|
196
216
|
|
|
197
217
|
|
|
198
218
|
0.1.0 – 2025-01-29
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
learning_credentials/__init__.py,sha256=
|
|
1
|
+
learning_credentials/__init__.py,sha256=WC8ADc58m8TrgemAhcJju3prDGwnvaNe1CUacYQlM9k,89
|
|
2
2
|
learning_credentials/admin.py,sha256=ynK3tVJwLsIeV7Jk66t1FAVyVsU1G-KRIAdRkycVTmA,10439
|
|
3
3
|
learning_credentials/apps.py,sha256=AA6JYUyqKYvNJ5POtQKw_s1g1VrUXuQI96hbea9H220,761
|
|
4
|
-
learning_credentials/compat.py,sha256=
|
|
4
|
+
learning_credentials/compat.py,sha256=Btm1Ii3D0nHuPZWZya_VR0JkkFcNRstuwg7A1DXlWG0,4547
|
|
5
5
|
learning_credentials/exceptions.py,sha256=UaqBVXFMWR2Iob7_LMb3j4NNVmWQFAgLi_MNMRUvGsI,290
|
|
6
|
-
learning_credentials/generators.py,sha256=
|
|
7
|
-
learning_credentials/models.py,sha256=
|
|
8
|
-
learning_credentials/processors.py,sha256=
|
|
6
|
+
learning_credentials/generators.py,sha256=Tzl9fLEVxrjAB1lUYhifGEpIU3JzWPcwvFHeHcVxc4M,8960
|
|
7
|
+
learning_credentials/models.py,sha256=Wepzng9WYDAxF8ptyQokp_9jCmuEv_4FY7ytkKFS4uU,16047
|
|
8
|
+
learning_credentials/processors.py,sha256=VeTeOfLuBNJOWQFSDgFrNjqxk55dBJKCfyWy9dfCJDI,15262
|
|
9
9
|
learning_credentials/tasks.py,sha256=byoFEUvN_ayVaU5K5SlEiA7vu9BRPaSSmKnB9g5toec,1927
|
|
10
10
|
learning_credentials/urls.py,sha256=2YLZZW738D7Afyzq6hr5ajWIl6azmX-hNDGUg_8AFpE,370
|
|
11
11
|
learning_credentials/views.py,sha256=1iBgQYelVHO_QWtoUZfVeyUc0o89IxQWAIwjPjaYaBQ,12
|
|
12
|
-
learning_credentials/migrations/0001_initial.py,sha256=
|
|
13
|
-
learning_credentials/migrations/0002_migrate_to_learning_credentials.py,sha256=
|
|
12
|
+
learning_credentials/migrations/0001_initial.py,sha256=61EvThCv-0UAnhCE5feyQVfjRodbp-6cDaAr4CY5PMA,8435
|
|
13
|
+
learning_credentials/migrations/0002_migrate_to_learning_credentials.py,sha256=vUhcnQKDdwOsppkXsjz2zZwOGMwIJ-fkQRsaj-K7l1o,1779
|
|
14
14
|
learning_credentials/migrations/0003_rename_certificates_to_credentials.py,sha256=YqSaHTB60VNc9k245um2GYVDH6J0l9BrN3ak6WKljjk,4677
|
|
15
15
|
learning_credentials/migrations/0004_replace_course_keys_with_learning_context_keys.py,sha256=5KaXvASl69qbEaHX5_Ty_3Dr7K4WV6p8VWOx72yJnTU,1919
|
|
16
16
|
learning_credentials/migrations/0005_rename_processors_and_generators.py,sha256=5UCqjq-CBJnRo1qBAoWs91ngyEuSMN8_tQtfzsuR5SI,5271
|
|
17
|
+
learning_credentials/migrations/0006_cleanup_openedx_certificates_tables.py,sha256=aJs_gOP4TmW9J-Dmr21m94jBfLQxzjAu6-ua7x4uYLE,727
|
|
17
18
|
learning_credentials/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
19
|
learning_credentials/settings/__init__.py,sha256=tofc5eg3Q2lV13Ff_jjg1ggGgWpKYoeESkP1qxl3H_A,29
|
|
19
|
-
learning_credentials/settings/common.py,sha256=
|
|
20
|
+
learning_credentials/settings/common.py,sha256=4n9AeQD-GB2MYFVrwXWEsTSrKC9btn8bgyr9OQuXNsY,302
|
|
20
21
|
learning_credentials/settings/production.py,sha256=yEvsCldHOdsIswW7TPLW__b9YNEK-Qy05rX5WSAcEeo,484
|
|
21
22
|
learning_credentials/templates/learning_credentials/base.html,sha256=wtjBYqfHmOnyEY5tN3VGOmzYLsOD24MXdEUhTZ7OmwI,662
|
|
22
23
|
learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/body.html,sha256=o-tfFQSNf-tuu_YzPosm0SFxUXe9oPh17PyjdiVSBhQ,811
|
|
@@ -24,14 +25,9 @@ learning_credentials/templates/learning_credentials/edx_ace/certificate_generate
|
|
|
24
25
|
learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/from_name.txt,sha256=-n8tjPSwfwAfeOSZ1WhcCTrpOah4VswzMZ5mh63Pxow,20
|
|
25
26
|
learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/head.html,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
27
|
learning_credentials/templates/learning_credentials/edx_ace/certificate_generated/email/subject.txt,sha256=S7Hc5T_sZSsSBXm5_H5HBNNv16Ohl0oZn0nVqqeWL0g,132
|
|
27
|
-
learning_credentials-0.2.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
learning_credentials-0.2.0rc3.dist-info/METADATA,sha256=qyLILPg96zErzmjzY0LLq7kGfDS0gg1Q78ltoK39-4c,6621
|
|
34
|
-
learning_credentials-0.2.0rc3.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
|
|
35
|
-
learning_credentials-0.2.0rc3.dist-info/entry_points.txt,sha256=Ll51HUyeZ2UnWjOXHSx09FPTFs9VMIwDccq-mn2wFEc,166
|
|
36
|
-
learning_credentials-0.2.0rc3.dist-info/top_level.txt,sha256=IC4tbU9MNfH-NkPgSUzE0UEurEMTpK3TJPHmeRf7kVQ,42
|
|
37
|
-
learning_credentials-0.2.0rc3.dist-info/RECORD,,
|
|
28
|
+
learning_credentials-0.2.2rc1.dist-info/licenses/LICENSE.txt,sha256=GDpsPnW_1NKhPvZpZL9imz25P2nIpbwJPEhrlq4vPAU,34523
|
|
29
|
+
learning_credentials-0.2.2rc1.dist-info/METADATA,sha256=TolfKrRfS0JaLfa5Tn13slCLIh9uF62LELvAuUyjfvs,6875
|
|
30
|
+
learning_credentials-0.2.2rc1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
31
|
+
learning_credentials-0.2.2rc1.dist-info/entry_points.txt,sha256=hHqqLUEdzAN24v5OGBX9Fr-wh3ATDPjQjByKz03eC2Y,91
|
|
32
|
+
learning_credentials-0.2.2rc1.dist-info/top_level.txt,sha256=Ce-4_leZe_nny7CpmkeRiemcDV6jIHpIvLjlcQBuf18,21
|
|
33
|
+
learning_credentials-0.2.2rc1.dist-info/RECORD,,
|
openedx_certificates/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"""Legacy module for Open edX certificates. It exists for backward compatibility."""
|
openedx_certificates/apps.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"""openedx_certificates Django application initialization."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from django.apps import AppConfig
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class OpenedxCertificatesConfig(AppConfig):
|
|
9
|
-
"""Configuration for the openedx_certificates Django application."""
|
|
10
|
-
|
|
11
|
-
name = 'openedx_certificates'
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
# Generated by Django 3.2.23 on 2023-11-14 15:54
|
|
2
|
-
|
|
3
|
-
from django.db import migrations, models
|
|
4
|
-
import django.db.models.deletion
|
|
5
|
-
import django.utils.timezone
|
|
6
|
-
import jsonfield.fields
|
|
7
|
-
import model_utils.fields
|
|
8
|
-
import opaque_keys.edx.django.models
|
|
9
|
-
import openedx_certificates.models
|
|
10
|
-
import uuid
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class Migration(migrations.Migration):
|
|
14
|
-
initial = True
|
|
15
|
-
|
|
16
|
-
dependencies = [
|
|
17
|
-
('django_celery_beat', '0018_improve_crontab_helptext'),
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
operations = [
|
|
21
|
-
migrations.CreateModel(
|
|
22
|
-
name='ExternalCertificateAsset',
|
|
23
|
-
fields=[
|
|
24
|
-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
25
|
-
(
|
|
26
|
-
'created',
|
|
27
|
-
model_utils.fields.AutoCreatedField(
|
|
28
|
-
default=django.utils.timezone.now, editable=False, verbose_name='created'
|
|
29
|
-
),
|
|
30
|
-
),
|
|
31
|
-
(
|
|
32
|
-
'modified',
|
|
33
|
-
model_utils.fields.AutoLastModifiedField(
|
|
34
|
-
default=django.utils.timezone.now, editable=False, verbose_name='modified'
|
|
35
|
-
),
|
|
36
|
-
),
|
|
37
|
-
('description', models.CharField(blank=True, help_text='Description of the asset.', max_length=255)),
|
|
38
|
-
(
|
|
39
|
-
'asset',
|
|
40
|
-
models.FileField(
|
|
41
|
-
help_text='Asset file. It could be a PDF template, image or font file.',
|
|
42
|
-
max_length=255,
|
|
43
|
-
upload_to=openedx_certificates.models.ExternalCertificateAsset.template_assets_path,
|
|
44
|
-
),
|
|
45
|
-
),
|
|
46
|
-
(
|
|
47
|
-
'asset_slug',
|
|
48
|
-
models.SlugField(
|
|
49
|
-
help_text="Asset's unique slug. We can reference the asset in templates using this value.",
|
|
50
|
-
max_length=255,
|
|
51
|
-
unique=True,
|
|
52
|
-
),
|
|
53
|
-
),
|
|
54
|
-
],
|
|
55
|
-
options={
|
|
56
|
-
'get_latest_by': 'created',
|
|
57
|
-
},
|
|
58
|
-
),
|
|
59
|
-
migrations.CreateModel(
|
|
60
|
-
name='ExternalCertificateType',
|
|
61
|
-
fields=[
|
|
62
|
-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
63
|
-
(
|
|
64
|
-
'created',
|
|
65
|
-
model_utils.fields.AutoCreatedField(
|
|
66
|
-
default=django.utils.timezone.now, editable=False, verbose_name='created'
|
|
67
|
-
),
|
|
68
|
-
),
|
|
69
|
-
(
|
|
70
|
-
'modified',
|
|
71
|
-
model_utils.fields.AutoLastModifiedField(
|
|
72
|
-
default=django.utils.timezone.now, editable=False, verbose_name='modified'
|
|
73
|
-
),
|
|
74
|
-
),
|
|
75
|
-
('name', models.CharField(help_text='Name of the certificate type.', max_length=255, unique=True)),
|
|
76
|
-
(
|
|
77
|
-
'retrieval_func',
|
|
78
|
-
models.CharField(help_text='A name of the function to retrieve eligible users.', max_length=200),
|
|
79
|
-
),
|
|
80
|
-
(
|
|
81
|
-
'generation_func',
|
|
82
|
-
models.CharField(help_text='A name of the function to generate certificates.', max_length=200),
|
|
83
|
-
),
|
|
84
|
-
(
|
|
85
|
-
'custom_options',
|
|
86
|
-
jsonfield.fields.JSONField(blank=True, default=dict, help_text='Custom options for the functions.'),
|
|
87
|
-
),
|
|
88
|
-
],
|
|
89
|
-
options={
|
|
90
|
-
'abstract': False,
|
|
91
|
-
},
|
|
92
|
-
),
|
|
93
|
-
migrations.CreateModel(
|
|
94
|
-
name='ExternalCertificate',
|
|
95
|
-
fields=[
|
|
96
|
-
(
|
|
97
|
-
'created',
|
|
98
|
-
model_utils.fields.AutoCreatedField(
|
|
99
|
-
default=django.utils.timezone.now, editable=False, verbose_name='created'
|
|
100
|
-
),
|
|
101
|
-
),
|
|
102
|
-
(
|
|
103
|
-
'modified',
|
|
104
|
-
model_utils.fields.AutoLastModifiedField(
|
|
105
|
-
default=django.utils.timezone.now, editable=False, verbose_name='modified'
|
|
106
|
-
),
|
|
107
|
-
),
|
|
108
|
-
(
|
|
109
|
-
'uuid',
|
|
110
|
-
models.UUIDField(
|
|
111
|
-
default=uuid.uuid4,
|
|
112
|
-
editable=False,
|
|
113
|
-
help_text='Auto-generated UUID of the certificate',
|
|
114
|
-
primary_key=True,
|
|
115
|
-
serialize=False,
|
|
116
|
-
),
|
|
117
|
-
),
|
|
118
|
-
('user_id', models.IntegerField(help_text='ID of the user receiving the certificate')),
|
|
119
|
-
('user_full_name', models.CharField(help_text='User receiving the certificate', max_length=255)),
|
|
120
|
-
(
|
|
121
|
-
'course_id',
|
|
122
|
-
opaque_keys.edx.django.models.CourseKeyField(
|
|
123
|
-
help_text='ID of a course for which the certificate was issued', max_length=255
|
|
124
|
-
),
|
|
125
|
-
),
|
|
126
|
-
('certificate_type', models.CharField(help_text='Type of the certificate', max_length=255)),
|
|
127
|
-
(
|
|
128
|
-
'status',
|
|
129
|
-
models.CharField(
|
|
130
|
-
choices=[
|
|
131
|
-
('generating', 'Generating'),
|
|
132
|
-
('available', 'Available'),
|
|
133
|
-
('error', 'Error'),
|
|
134
|
-
('invalidated', 'Invalidated'),
|
|
135
|
-
],
|
|
136
|
-
default='generating',
|
|
137
|
-
help_text='Status of the certificate generation task',
|
|
138
|
-
max_length=32,
|
|
139
|
-
),
|
|
140
|
-
),
|
|
141
|
-
(
|
|
142
|
-
'download_url',
|
|
143
|
-
models.URLField(blank=True, help_text='URL of the generated certificate PDF (e.g., to S3)'),
|
|
144
|
-
),
|
|
145
|
-
(
|
|
146
|
-
'legacy_id',
|
|
147
|
-
models.IntegerField(
|
|
148
|
-
help_text='Legacy ID of the certificate imported from another system', null=True
|
|
149
|
-
),
|
|
150
|
-
),
|
|
151
|
-
('generation_task_id', models.CharField(help_text='Task ID from the Celery queue', max_length=255)),
|
|
152
|
-
],
|
|
153
|
-
options={
|
|
154
|
-
'unique_together': {('user_id', 'course_id', 'certificate_type')},
|
|
155
|
-
},
|
|
156
|
-
),
|
|
157
|
-
migrations.CreateModel(
|
|
158
|
-
name='ExternalCertificateCourseConfiguration',
|
|
159
|
-
fields=[
|
|
160
|
-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
161
|
-
(
|
|
162
|
-
'created',
|
|
163
|
-
model_utils.fields.AutoCreatedField(
|
|
164
|
-
default=django.utils.timezone.now, editable=False, verbose_name='created'
|
|
165
|
-
),
|
|
166
|
-
),
|
|
167
|
-
(
|
|
168
|
-
'modified',
|
|
169
|
-
model_utils.fields.AutoLastModifiedField(
|
|
170
|
-
default=django.utils.timezone.now, editable=False, verbose_name='modified'
|
|
171
|
-
),
|
|
172
|
-
),
|
|
173
|
-
(
|
|
174
|
-
'course_id',
|
|
175
|
-
opaque_keys.edx.django.models.CourseKeyField(help_text='The ID of the course.', max_length=255),
|
|
176
|
-
),
|
|
177
|
-
(
|
|
178
|
-
'custom_options',
|
|
179
|
-
jsonfield.fields.JSONField(
|
|
180
|
-
blank=True,
|
|
181
|
-
default=dict,
|
|
182
|
-
help_text='Custom options for the functions. If specified, they are merged with the options defined in the certificate type.',
|
|
183
|
-
),
|
|
184
|
-
),
|
|
185
|
-
(
|
|
186
|
-
'certificate_type',
|
|
187
|
-
models.ForeignKey(
|
|
188
|
-
help_text='Associated certificate type.',
|
|
189
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
190
|
-
to='openedx_certificates.externalcertificatetype',
|
|
191
|
-
),
|
|
192
|
-
),
|
|
193
|
-
(
|
|
194
|
-
'periodic_task',
|
|
195
|
-
models.OneToOneField(
|
|
196
|
-
help_text='Associated periodic task.',
|
|
197
|
-
on_delete=django.db.models.deletion.CASCADE,
|
|
198
|
-
to='django_celery_beat.periodictask',
|
|
199
|
-
),
|
|
200
|
-
),
|
|
201
|
-
],
|
|
202
|
-
options={
|
|
203
|
-
'unique_together': {('course_id', 'certificate_type')},
|
|
204
|
-
},
|
|
205
|
-
),
|
|
206
|
-
]
|
|
File without changes
|
openedx_certificates/models.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Proxy models for backward compatibility with the old app structure.
|
|
3
|
-
|
|
4
|
-
These will redirect to the new models in learning_credentials.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from learning_credentials.models import Credential as LearningCredential
|
|
8
|
-
from learning_credentials.models import CredentialAsset as LearningCredentialAsset
|
|
9
|
-
from learning_credentials.models import CredentialConfiguration as LearningCredentialConfiguration
|
|
10
|
-
from learning_credentials.models import CredentialType as LearningCredentialType
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class ExternalCertificate(LearningCredential):
|
|
14
|
-
"""Proxy model for backward compatibility."""
|
|
15
|
-
|
|
16
|
-
class Meta: # noqa: D106
|
|
17
|
-
proxy = True
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class ExternalCertificateAsset(LearningCredentialAsset):
|
|
21
|
-
"""Proxy model for backward compatibility."""
|
|
22
|
-
|
|
23
|
-
class Meta: # noqa: D106
|
|
24
|
-
proxy = True
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class ExternalCertificateType(LearningCredentialType):
|
|
28
|
-
"""Proxy model for backward compatibility."""
|
|
29
|
-
|
|
30
|
-
class Meta: # noqa: D106
|
|
31
|
-
proxy = True
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class ExternalCertificateCourseConfiguration(LearningCredentialConfiguration):
|
|
35
|
-
"""Proxy model for backward compatibility."""
|
|
36
|
-
|
|
37
|
-
class Meta: # noqa: D106
|
|
38
|
-
proxy = True
|
|
File without changes
|