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.
Files changed (26) hide show
  1. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/PKG-INFO +1 -1
  2. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/admin.py +47 -3
  3. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/pyproject.toml +1 -1
  4. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/.gitignore +0 -0
  5. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/LICENCE +0 -0
  6. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/README.rst +0 -0
  7. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/__init__.py +0 -0
  8. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/apps.py +0 -0
  9. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/constants.py +0 -0
  10. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/management/__init__.py +0 -0
  11. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/management/commands/__init__.py +0 -0
  12. {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
  13. {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
  14. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/migrations/0001_initial.py +0 -0
  15. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/migrations/__init__.py +0 -0
  16. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/models.py +0 -0
  17. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/pipeline.py +0 -0
  18. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/__init__.py +0 -0
  19. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/common.py +0 -0
  20. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/filters.py +0 -0
  21. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/settings/production.py +0 -0
  22. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/signals.py +0 -0
  23. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/tasks.py +0 -0
  24. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/urls.py +0 -0
  25. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/utils.py +0 -0
  26. {ol_openedx_course_sync-1.2.2 → ol_openedx_course_sync-1.2.3}/ol_openedx_course_sync/views.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ol-openedx-course-sync
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: An Open edX plugin to sync course changes to its reruns.
5
5
  Author: MIT Office of Digital Learning
6
6
  License-Expression: BSD-3-Clause
@@ -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
- org_choices = [
30
- (org.name, org.name) for org in Organization.objects.filter(active=True)
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(choices=org_choices)
74
+ self.fields["organization"] = forms.ChoiceField(
75
+ choices=org_choices, widget=SearchableSelect
76
+ )
33
77
 
34
78
 
35
79
  @admin.register(CourseSyncOrganization)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ol-openedx-course-sync"
3
- version = "1.2.2"
3
+ version = "1.2.3"
4
4
  description = "An Open edX plugin to sync course changes to its reruns."
5
5
  authors = [
6
6
  {name = "MIT Office of Digital Learning"}