ol-openedx-course-sync 1.2.2__tar.gz → 1.2.3__tar.gz
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.
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/PKG-INFO +1 -1
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/admin.py +47 -3
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/pyproject.toml +1 -1
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/.gitignore +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/LICENCE +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/README.rst +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/__init__.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/apps.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/constants.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/management/__init__.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/management/commands/__init__.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/management/commands/migrate_legacy_library_blocks_to_item_bank.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/management/commands/sync_problem_actions.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/migrations/0001_initial.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/migrations/__init__.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/models.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/pipeline.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/__init__.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/common.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/filters.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/production.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/signals.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/tasks.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/urls.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/utils.py +0 -0
- {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/views.py +0 -0
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/admin.py
RENAMED
|
@@ -7,6 +7,9 @@ import logging
|
|
|
7
7
|
from django import forms
|
|
8
8
|
from django.conf import settings
|
|
9
9
|
from django.contrib import admin
|
|
10
|
+
from django.contrib.admin.widgets import get_select2_language
|
|
11
|
+
from django.db.models.fields import BLANK_CHOICE_DASH
|
|
12
|
+
from django.utils.html import format_html
|
|
10
13
|
from organizations.models import Organization
|
|
11
14
|
|
|
12
15
|
from ol_openedx_course_sync.models import CourseSyncMapping, CourseSyncOrganization
|
|
@@ -15,6 +18,43 @@ from ol_openedx_course_sync.tasks import async_course_assets_sync, async_course_
|
|
|
15
18
|
log = logging.getLogger(__name__)
|
|
16
19
|
|
|
17
20
|
|
|
21
|
+
class SearchableSelect(forms.Select):
|
|
22
|
+
"""
|
|
23
|
+
Select enhanced with the admin's bundled Select2, filtering the local options
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def media(self):
|
|
28
|
+
# Match ModelAdmin's DEBUG-dependent jQuery file so it isn't loaded twice
|
|
29
|
+
extra = "" if settings.DEBUG else ".min"
|
|
30
|
+
i18n_name = get_select2_language()
|
|
31
|
+
i18n_file = (
|
|
32
|
+
(f"admin/js/vendor/select2/i18n/{i18n_name}.js",) if i18n_name else ()
|
|
33
|
+
)
|
|
34
|
+
return forms.Media(
|
|
35
|
+
js=(
|
|
36
|
+
f"admin/js/vendor/jquery/jquery{extra}.js",
|
|
37
|
+
f"admin/js/vendor/select2/select2.full{extra}.js",
|
|
38
|
+
*i18n_file,
|
|
39
|
+
"admin/js/jquery.init.js",
|
|
40
|
+
),
|
|
41
|
+
css={
|
|
42
|
+
"screen": (
|
|
43
|
+
f"admin/css/vendor/select2/select2{extra}.css",
|
|
44
|
+
"admin/css/autocomplete.css",
|
|
45
|
+
)
|
|
46
|
+
},
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def render(self, name, value, attrs=None, renderer=None):
|
|
50
|
+
# admin-autocomplete theme matches the admin's own autocomplete styling
|
|
51
|
+
attrs = {**(attrs or {}), "data-theme": "admin-autocomplete"}
|
|
52
|
+
return super().render(name, value, attrs, renderer) + format_html(
|
|
53
|
+
'<script>django.jQuery(function($) {{ $("#{}").select2(); }});</script>',
|
|
54
|
+
attrs["id"],
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
18
58
|
class CourseSyncOrganizationForm(forms.ModelForm):
|
|
19
59
|
"""
|
|
20
60
|
Form for CourseSyncOrganization model
|
|
@@ -26,10 +66,14 @@ class CourseSyncOrganizationForm(forms.ModelForm):
|
|
|
26
66
|
|
|
27
67
|
def __init__(self, *args, **kwargs):
|
|
28
68
|
super().__init__(*args, **kwargs)
|
|
29
|
-
|
|
30
|
-
|
|
69
|
+
# Store short_name: sync matches it against course_key.org
|
|
70
|
+
org_choices = BLANK_CHOICE_DASH + [
|
|
71
|
+
(org.short_name, f"{org.name} ({org.short_name})")
|
|
72
|
+
for org in Organization.objects.filter(active=True)
|
|
31
73
|
]
|
|
32
|
-
self.fields["organization"] = forms.ChoiceField(
|
|
74
|
+
self.fields["organization"] = forms.ChoiceField(
|
|
75
|
+
choices=org_choices, widget=SearchableSelect
|
|
76
|
+
)
|
|
33
77
|
|
|
34
78
|
|
|
35
79
|
@admin.register(CourseSyncOrganization)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/__init__.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/apps.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/models.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/pipeline.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/signals.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/tasks.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/urls.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/utils.py
RENAMED
|
File without changes
|
{ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/views.py
RENAMED
|
File without changes
|