ol-openedx-git-auto-export 0.7.2__tar.gz → 0.8.1__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_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/PKG-INFO +60 -2
  2. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/README.rst +59 -1
  3. ol_openedx_git_auto_export-0.8.1/ol_openedx_git_auto_export/admin.py +81 -0
  4. ol_openedx_git_auto_export-0.8.1/ol_openedx_git_auto_export/app.py +77 -0
  5. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/constants.py +23 -0
  6. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/management/commands/migrate_giturl.py +7 -7
  7. ol_openedx_git_auto_export-0.8.1/ol_openedx_git_auto_export/migrations/0002_contentgitrepository.py +37 -0
  8. ol_openedx_git_auto_export-0.8.1/ol_openedx_git_auto_export/models.py +28 -0
  9. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/settings/common.py +12 -0
  10. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/settings/production.py +12 -0
  11. ol_openedx_git_auto_export-0.8.1/ol_openedx_git_auto_export/signals.py +171 -0
  12. ol_openedx_git_auto_export-0.8.1/ol_openedx_git_auto_export/tasks.py +202 -0
  13. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/utils.py +116 -6
  14. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/pyproject.toml +1 -1
  15. ol_openedx_git_auto_export-0.7.2/ol_openedx_git_auto_export/admin.py +0 -34
  16. ol_openedx_git_auto_export-0.7.2/ol_openedx_git_auto_export/app.py +0 -42
  17. ol_openedx_git_auto_export-0.7.2/ol_openedx_git_auto_export/models.py +0 -25
  18. ol_openedx_git_auto_export-0.7.2/ol_openedx_git_auto_export/signals.py +0 -60
  19. ol_openedx_git_auto_export-0.7.2/ol_openedx_git_auto_export/tasks.py +0 -160
  20. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/.gitignore +0 -0
  21. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/LICENSE +0 -0
  22. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/__init__.py +0 -0
  23. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/management/commands/__init__.py +0 -0
  24. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/migrations/0001_initial.py +0 -0
  25. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/migrations/__init__.py +0 -0
  26. {ol_openedx_git_auto_export-0.7.2 → ol_openedx_git_auto_export-0.8.1}/ol_openedx_git_auto_export/settings/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ol-openedx-git-auto-export
3
- Version: 0.7.2
3
+ Version: 0.8.1
4
4
  Summary: A plugin that auto saves the course OLX to git when an author publishes it
5
5
  Author: MIT Office of Digital Learning
6
6
  License-Expression: BSD-3-Clause
@@ -63,7 +63,7 @@ https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account)
63
63
 
64
64
  Studio/CMS UI settings
65
65
  ----------------------
66
- - Open studio admin at `/admin/ol_openedx_git_auto_export/coursegitrepository/`
66
+ - Open studio admin at ``/admin/ol_openedx_git_auto_export/contentgitrepository/``
67
67
  - Add your course_id and in the GIT URL, add your OLX git repo. For example ``git@github.com:<GITHUB_USERNAME>/edx4edxlite.git``.
68
68
  - Make a change to the course content and publish.
69
69
  - When using Tutor, attach with the CMS container using ``tutor dev/local start cms`` and enter ``yes`` to the prompt to add the GitHub to known hosts.
@@ -71,3 +71,61 @@ Studio/CMS UI settings
71
71
  - Commit user should be the one that published the change.
72
72
  - If user is not available, it should be the default one set in ``GIT_EXPORT_DEFAULT_IDENT``.
73
73
  - Test commit count increase on your OLX repo.
74
+
75
+ Library Support
76
+ ===============
77
+
78
+ This plugin supports automatic git export for both **courses** and **content libraries**.
79
+
80
+ Library v1 (Legacy Libraries)
81
+ ------------------------------
82
+
83
+ **Library Key Format:** ``library-v1:org+library``
84
+
85
+ **Supported Operations:**
86
+
87
+ - ✅ **Auto-export on update**: When you update/publish a library v1, changes are automatically exported to git
88
+ - ✅ **Auto-repo creation**: Library v1 does NOT have a creation signal in Open edX, so the GitHub repository is automatically created on the first library update signal
89
+
90
+ **Setup for Library v1:**
91
+
92
+ 1. Enable the library feature flags in your config:
93
+
94
+ .. code-block::
95
+
96
+ "FEATURES": {
97
+ "ENABLE_GIT_AUTO_LIBRARY_EXPORT": true,
98
+ "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION": true
99
+ }
100
+
101
+ 2. Make changes to your library and publish
102
+
103
+ Library v2 (Content Libraries)
104
+ -------------------------------
105
+
106
+ **Library Key Format:** ``lib:org:slug``
107
+
108
+ **Supported Operations:**
109
+
110
+ - ✅ **Auto-export on update**: When you update a library v2, changes are automatically exported to git
111
+ - ✅ **Auto-repo creation**: When you create a new library v2, a GitHub repository can be automatically created
112
+
113
+ **Setup for Library v2:**
114
+
115
+ 1. Enable the library feature flags in your config:
116
+
117
+ .. code-block::
118
+
119
+ "FEATURES": {
120
+ "ENABLE_GIT_AUTO_LIBRARY_EXPORT": true,
121
+ "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION": true
122
+ }
123
+
124
+ 2. When creating a new library v2, if ``ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION`` is enabled, a GitHub repository will be created automatically
125
+ 3. Updates to the library will be automatically exported to git
126
+
127
+ **Important Notes:**
128
+
129
+ - Library v1 does not emit a creation signal, so the GitHub repository is automatically created on the first library update
130
+ - Library v2 uses the new event architecture and supports both creation and update signals for immediate repository creation
131
+ - Both library types support automatic git export on updates once configured
@@ -47,7 +47,7 @@ https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account)
47
47
 
48
48
  Studio/CMS UI settings
49
49
  ----------------------
50
- - Open studio admin at `/admin/ol_openedx_git_auto_export/coursegitrepository/`
50
+ - Open studio admin at ``/admin/ol_openedx_git_auto_export/contentgitrepository/``
51
51
  - Add your course_id and in the GIT URL, add your OLX git repo. For example ``git@github.com:<GITHUB_USERNAME>/edx4edxlite.git``.
52
52
  - Make a change to the course content and publish.
53
53
  - When using Tutor, attach with the CMS container using ``tutor dev/local start cms`` and enter ``yes`` to the prompt to add the GitHub to known hosts.
@@ -55,3 +55,61 @@ Studio/CMS UI settings
55
55
  - Commit user should be the one that published the change.
56
56
  - If user is not available, it should be the default one set in ``GIT_EXPORT_DEFAULT_IDENT``.
57
57
  - Test commit count increase on your OLX repo.
58
+
59
+ Library Support
60
+ ===============
61
+
62
+ This plugin supports automatic git export for both **courses** and **content libraries**.
63
+
64
+ Library v1 (Legacy Libraries)
65
+ ------------------------------
66
+
67
+ **Library Key Format:** ``library-v1:org+library``
68
+
69
+ **Supported Operations:**
70
+
71
+ - ✅ **Auto-export on update**: When you update/publish a library v1, changes are automatically exported to git
72
+ - ✅ **Auto-repo creation**: Library v1 does NOT have a creation signal in Open edX, so the GitHub repository is automatically created on the first library update signal
73
+
74
+ **Setup for Library v1:**
75
+
76
+ 1. Enable the library feature flags in your config:
77
+
78
+ .. code-block::
79
+
80
+ "FEATURES": {
81
+ "ENABLE_GIT_AUTO_LIBRARY_EXPORT": true,
82
+ "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION": true
83
+ }
84
+
85
+ 2. Make changes to your library and publish
86
+
87
+ Library v2 (Content Libraries)
88
+ -------------------------------
89
+
90
+ **Library Key Format:** ``lib:org:slug``
91
+
92
+ **Supported Operations:**
93
+
94
+ - ✅ **Auto-export on update**: When you update a library v2, changes are automatically exported to git
95
+ - ✅ **Auto-repo creation**: When you create a new library v2, a GitHub repository can be automatically created
96
+
97
+ **Setup for Library v2:**
98
+
99
+ 1. Enable the library feature flags in your config:
100
+
101
+ .. code-block::
102
+
103
+ "FEATURES": {
104
+ "ENABLE_GIT_AUTO_LIBRARY_EXPORT": true,
105
+ "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION": true
106
+ }
107
+
108
+ 2. When creating a new library v2, if ``ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION`` is enabled, a GitHub repository will be created automatically
109
+ 3. Updates to the library will be automatically exported to git
110
+
111
+ **Important Notes:**
112
+
113
+ - Library v1 does not emit a creation signal, so the GitHub repository is automatically created on the first library update
114
+ - Library v2 uses the new event architecture and supports both creation and update signals for immediate repository creation
115
+ - Both library types support automatic git export on updates once configured
@@ -0,0 +1,81 @@
1
+ """
2
+ Django admin pages for git-auto-export plugin
3
+ """
4
+
5
+ from django.contrib import admin
6
+ from django.contrib.admin import SimpleListFilter
7
+ from django.db.models import Q
8
+ from opaque_keys.edx.locator import LibraryLocator, LibraryLocatorV2
9
+
10
+ from ol_openedx_git_auto_export.constants import (
11
+ LIBRARY_V1_PREFIX,
12
+ LIBRARY_V2_PREFIX,
13
+ ContentType,
14
+ )
15
+ from ol_openedx_git_auto_export.models import ContentGitRepository
16
+
17
+
18
+ class ContentTypeFilter(SimpleListFilter):
19
+ """Filter for content type (Course or Library)."""
20
+
21
+ title = "content type"
22
+ parameter_name = "content_type"
23
+
24
+ def lookups(self, request, model_admin): # noqa: ARG002
25
+ """Return filter options."""
26
+ return (
27
+ (ContentType.COURSE.value, ContentType.COURSE.display_name),
28
+ (ContentType.LIBRARY.value, ContentType.LIBRARY.display_name),
29
+ )
30
+
31
+ def queryset(self, request, queryset): # noqa: ARG002
32
+ """Filter the queryset based on the selected content type."""
33
+ if self.value() == ContentType.COURSE.value:
34
+ # Filter for courses (exclude libraries)
35
+ return queryset.exclude(content_key__startswith=LIBRARY_V1_PREFIX).exclude(
36
+ content_key__startswith=LIBRARY_V2_PREFIX
37
+ )
38
+ elif self.value() == ContentType.LIBRARY.value:
39
+ # Filter for libraries
40
+ return queryset.filter(
41
+ Q(content_key__startswith=LIBRARY_V1_PREFIX)
42
+ | Q(content_key__startswith=LIBRARY_V2_PREFIX)
43
+ )
44
+ return queryset
45
+
46
+
47
+ @admin.register(ContentGitRepository)
48
+ class ContentGitRepositoryAdmin(admin.ModelAdmin):
49
+ """
50
+ Admin interface for the ContentGitRepository model.
51
+
52
+ This model supports both courses and libraries.
53
+ """
54
+
55
+ list_display = (
56
+ "content_key",
57
+ "git_url",
58
+ "is_export_enabled",
59
+ "content_type_display",
60
+ )
61
+ search_fields = ("content_key", "git_url")
62
+ list_filter = ("is_export_enabled", ContentTypeFilter)
63
+ list_per_page = 50
64
+
65
+ @admin.display(description="Content Type")
66
+ def content_type_display(self, obj):
67
+ """Display whether the content is a course or library."""
68
+ if isinstance(obj.content_key, (LibraryLocator, LibraryLocatorV2)):
69
+ return ContentType.LIBRARY.display_name
70
+ return ContentType.COURSE.display_name
71
+
72
+ def has_delete_permission(self, request, obj=None): # noqa: ARG002
73
+ """
74
+ Disable delete permission for ContentGitRepository objects.
75
+
76
+ Deleting a ContentGitRepository could lead to orphaned repositories
77
+ on GitHub and loss of export functionality.
78
+
79
+ To stop exporting content, set `is_export_enabled` to False
80
+ """
81
+ return False
@@ -0,0 +1,77 @@
1
+ """
2
+ AppConfig for ol_openedx_git_auto_export app
3
+ """
4
+ # ruff: noqa: E501
5
+
6
+ from django.apps import AppConfig
7
+ from edx_django_utils.plugins import PluginSettings, PluginSignals
8
+ from openedx.core.djangoapps.plugins.constants import ProjectType, SettingsType
9
+
10
+
11
+ class GitAutoExportConfig(AppConfig):
12
+ """
13
+ App config for ol_openedx_git_auto_export django application.
14
+ """
15
+
16
+ name = "ol_openedx_git_auto_export"
17
+
18
+ plugin_app = {
19
+ PluginSettings.CONFIG: {
20
+ ProjectType.CMS: {
21
+ SettingsType.PRODUCTION: {
22
+ PluginSettings.RELATIVE_PATH: "settings.production"
23
+ },
24
+ SettingsType.COMMON: {PluginSettings.RELATIVE_PATH: "settings.common"},
25
+ }
26
+ },
27
+ PluginSignals.CONFIG: {
28
+ ProjectType.CMS: {
29
+ PluginSignals.RECEIVERS: [
30
+ {
31
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_course_publish",
32
+ PluginSignals.SIGNAL_PATH: "xmodule.modulestore.django.COURSE_PUBLISHED",
33
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_course_publish",
34
+ },
35
+ {
36
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_course_created",
37
+ PluginSignals.SIGNAL_PATH: "openedx_events.content_authoring.signals.COURSE_CREATED",
38
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_course_created",
39
+ },
40
+ # Library Signals
41
+ # NOTE: Library v1 (library-v1:) only has LIBRARY_UPDATED, no creation signal
42
+ # Library v2 (lib:) has:
43
+ # - CONTENT_LIBRARY_CREATED/UPDATED: for library metadata changes
44
+ # - LIBRARY_BLOCK_PUBLISHED: for block/component changes
45
+ {
46
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_library_v1_updated",
47
+ PluginSignals.SIGNAL_PATH: "xmodule.modulestore.django.LIBRARY_UPDATED", # library v1 update
48
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_library_v1_updated",
49
+ },
50
+ # lib V2 - Library-level signals
51
+ {
52
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_library_v2_created",
53
+ PluginSignals.SIGNAL_PATH: "openedx_events.content_authoring.signals.CONTENT_LIBRARY_CREATED", # library v2 only
54
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_library_v2_created",
55
+ },
56
+ {
57
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_library_v2_updated",
58
+ PluginSignals.SIGNAL_PATH: "openedx_events.content_authoring.signals.CONTENT_LIBRARY_UPDATED", # library v2 metadata only
59
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_library_v2_updated",
60
+ },
61
+ # lib V2 - Block-level signals (for component publish)
62
+ # Note: PUBLISHED signals capture all changes including deletions after publish
63
+ {
64
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_library_block_published",
65
+ PluginSignals.SIGNAL_PATH: "openedx_events.content_authoring.signals.LIBRARY_BLOCK_PUBLISHED",
66
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_library_block_published",
67
+ },
68
+ # lib V2 - Container-level signals (for container publish)
69
+ {
70
+ PluginSignals.RECEIVER_FUNC_NAME: "listen_for_library_container_published",
71
+ PluginSignals.SIGNAL_PATH: "openedx_events.content_authoring.signals.LIBRARY_CONTAINER_PUBLISHED",
72
+ PluginSignals.DISPATCH_UID: "ol_openedx_git_auto_export.signals.listen_for_library_container_published",
73
+ },
74
+ ],
75
+ },
76
+ },
77
+ }
@@ -1,8 +1,31 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class ContentType(StrEnum):
5
+ """Enumeration for content types (Course or Library)."""
6
+
7
+ COURSE = "course"
8
+ LIBRARY = "library"
9
+
10
+ @property
11
+ def display_name(self):
12
+ """Return the human-readable display name."""
13
+ return self.value.capitalize()
14
+
15
+
16
+ # Library key prefixes for different versions
17
+ LIBRARY_V1_PREFIX = "library-v1:"
18
+ LIBRARY_V2_PREFIX = "lib:"
19
+
1
20
  ENABLE_GIT_AUTO_EXPORT = "ENABLE_GIT_AUTO_EXPORT"
2
21
  ENABLE_AUTO_GITHUB_REPO_CREATION = "ENABLE_AUTO_GITHUB_REPO_CREATION"
3
22
  GITHUB_ORG = "GITHUB_ORG"
4
23
  GITHUB_ACCESS_TOKEN = "GITHUB_ACCESS_TOKEN" # noqa: S105
5
24
 
25
+ # Library-specific feature flags
26
+ ENABLE_GIT_AUTO_LIBRARY_EXPORT = "ENABLE_GIT_AUTO_LIBRARY_EXPORT"
27
+ ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION = "ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION"
28
+
6
29
  COURSE_RERUN_STATE_SUCCEEDED = "succeeded"
7
30
  REPOSITORY_NAME_MAX_LENGTH = 100 # Max length from GitHub for repo name
8
31
 
@@ -1,9 +1,9 @@
1
1
  """
2
2
  Django management command for migrating git URLs
3
- from course advance settings to CourseGitRepository model.
3
+ from course advance settings to ContentGitRepository model.
4
4
 
5
5
  This command scans existing courses in the modulestore for git URLs and migrates them
6
- to the CourseGitRepository model. It handles duplicate git URLs by creating new
6
+ to the ContentGitRepository model. It handles duplicate git URLs by creating new
7
7
  GitHub repositories for courses that would otherwise share the same repository.
8
8
 
9
9
  Usage:
@@ -20,7 +20,7 @@ Examples:
20
20
  The command will:
21
21
  1. Query all courses (or specified courses) from CourseOverview
22
22
  2. Extract git URLs from the course modulestore data
23
- 3. Create CourseGitRepository records for courses with git URLs
23
+ 3. Create ContentGitRepository records for courses with git URLs
24
24
  4. Handle duplicate git URLs by creating new GitHub repositories
25
25
  5. Create new GitHub repositories for courses without git URLs
26
26
 
@@ -33,7 +33,7 @@ from pathlib import Path
33
33
 
34
34
  from celery import group
35
35
  from django.core.management.base import BaseCommand
36
- from ol_openedx_git_auto_export.models import CourseGitRepository
36
+ from ol_openedx_git_auto_export.models import ContentGitRepository
37
37
  from ol_openedx_git_auto_export.tasks import (
38
38
  async_create_github_repo,
39
39
  )
@@ -44,7 +44,7 @@ from xmodule.modulestore.django import modulestore
44
44
 
45
45
  class Command(BaseCommand):
46
46
  help = """
47
- Migrate git URL from course(s) advanced settings to CourseGitRepository model
47
+ Migrate git URL from course(s) advanced settings to ContentGitRepository model
48
48
  """
49
49
 
50
50
  def add_arguments(self, parser):
@@ -126,8 +126,8 @@ class Command(BaseCommand):
126
126
  migration_logs["existing_repos"].append(
127
127
  {"course_id": str(course.id), "giturl": giturl}
128
128
  )
129
- CourseGitRepository.objects.get_or_create(
130
- course_key=course.id,
129
+ ContentGitRepository.objects.get_or_create(
130
+ content_key=course.id,
131
131
  defaults={"git_url": giturl},
132
132
  )
133
133
  continue
@@ -0,0 +1,37 @@
1
+ # Generated migration for renaming CourseGitRepository to ContentGitRepository
2
+
3
+ import opaque_keys.edx.django.models
4
+ from django.db import migrations
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+ dependencies = [
9
+ ("ol_openedx_git_auto_export", "0001_initial"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.RenameModel(
14
+ old_name="CourseGitRepository",
15
+ new_name="ContentGitRepository",
16
+ ),
17
+ migrations.RenameField(
18
+ model_name="contentgitrepository",
19
+ old_name="course_key",
20
+ new_name="content_key",
21
+ ),
22
+ migrations.AlterField(
23
+ model_name="contentgitrepository",
24
+ name="content_key",
25
+ field=opaque_keys.edx.django.models.LearningContextKeyField(
26
+ max_length=255, primary_key=True, serialize=False
27
+ ),
28
+ ),
29
+ migrations.AlterModelOptions(
30
+ name="contentgitrepository",
31
+ options={
32
+ "ordering": ["-created"],
33
+ "verbose_name": "Content Git Repository",
34
+ "verbose_name_plural": "Content Git Repositories",
35
+ },
36
+ ),
37
+ ]
@@ -0,0 +1,28 @@
1
+ """
2
+ Django models for the git auto-export plugin.
3
+ """
4
+
5
+ from django.db import models
6
+ from model_utils.models import TimeStampedModel
7
+ from opaque_keys.edx.django.models import LearningContextKeyField
8
+
9
+
10
+ class ContentGitRepository(TimeStampedModel):
11
+ """
12
+ Model to store Git repository information for courses and libraries.
13
+
14
+ This model uses LearningContextKeyField which supports both CourseKey
15
+ and LibraryLocator, making it suitable for both courses and libraries.
16
+ """
17
+
18
+ content_key = LearningContextKeyField(max_length=255, primary_key=True)
19
+ git_url = models.CharField(max_length=255)
20
+ is_export_enabled = models.BooleanField(default=True)
21
+
22
+ class Meta:
23
+ verbose_name = "Content Git Repository"
24
+ verbose_name_plural = "Content Git Repositories"
25
+ ordering = ["-created"]
26
+
27
+ def __str__(self):
28
+ return f"ContentGitRepository (content_key={self.content_key})"
@@ -1,8 +1,10 @@
1
1
  """Common settings unique to the git auto export plugin."""
2
2
 
3
3
  from ol_openedx_git_auto_export.constants import (
4
+ ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION,
4
5
  ENABLE_AUTO_GITHUB_REPO_CREATION,
5
6
  ENABLE_GIT_AUTO_EXPORT,
7
+ ENABLE_GIT_AUTO_LIBRARY_EXPORT,
6
8
  )
7
9
 
8
10
 
@@ -14,9 +16,19 @@ def plugin_settings(settings):
14
16
  )
15
17
  settings.GITHUB_ORG_API_URL = env_tokens.get("GITHUB_ORG_API_URL", "")
16
18
  settings.GITHUB_ACCESS_TOKEN = env_tokens.get("GITHUB_ACCESS_TOKEN")
19
+
20
+ # Course-specific settings
17
21
  settings.FEATURES[ENABLE_GIT_AUTO_EXPORT] = env_tokens.get("FEATURES", {}).get(
18
22
  ENABLE_GIT_AUTO_EXPORT, True
19
23
  )
20
24
  settings.FEATURES[ENABLE_AUTO_GITHUB_REPO_CREATION] = env_tokens.get(
21
25
  "FEATURES", {}
22
26
  ).get(ENABLE_AUTO_GITHUB_REPO_CREATION, False)
27
+
28
+ # Library-specific settings (disabled by default)
29
+ settings.FEATURES[ENABLE_GIT_AUTO_LIBRARY_EXPORT] = env_tokens.get(
30
+ "FEATURES", {}
31
+ ).get(ENABLE_GIT_AUTO_LIBRARY_EXPORT, False)
32
+ settings.FEATURES[ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION] = env_tokens.get(
33
+ "FEATURES", {}
34
+ ).get(ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION, False)
@@ -1,8 +1,10 @@
1
1
  """Production settings unique to the git auto export plugin."""
2
2
 
3
3
  from ol_openedx_git_auto_export.constants import (
4
+ ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION,
4
5
  ENABLE_AUTO_GITHUB_REPO_CREATION,
5
6
  ENABLE_GIT_AUTO_EXPORT,
7
+ ENABLE_GIT_AUTO_LIBRARY_EXPORT,
6
8
  )
7
9
 
8
10
 
@@ -14,9 +16,19 @@ def plugin_settings(settings):
14
16
  )
15
17
  settings.GITHUB_ORG_API_URL = env_tokens.get("GITHUB_ORG_API_URL", "")
16
18
  settings.GITHUB_ACCESS_TOKEN = env_tokens.get("GITHUB_ACCESS_TOKEN")
19
+
20
+ # Course-specific settings
17
21
  settings.FEATURES[ENABLE_GIT_AUTO_EXPORT] = env_tokens.get("FEATURES", {}).get(
18
22
  ENABLE_GIT_AUTO_EXPORT, True
19
23
  )
20
24
  settings.FEATURES[ENABLE_AUTO_GITHUB_REPO_CREATION] = env_tokens.get(
21
25
  "FEATURES", {}
22
26
  ).get(ENABLE_AUTO_GITHUB_REPO_CREATION, False)
27
+
28
+ # Library-specific settings (disabled by default)
29
+ settings.FEATURES[ENABLE_GIT_AUTO_LIBRARY_EXPORT] = env_tokens.get(
30
+ "FEATURES", {}
31
+ ).get(ENABLE_GIT_AUTO_LIBRARY_EXPORT, False)
32
+ settings.FEATURES[ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION] = env_tokens.get(
33
+ "FEATURES", {}
34
+ ).get(ENABLE_AUTO_GITHUB_LIBRARY_REPO_CREATION, False)