6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00

feat: custom importable courses

This makes it possible to import courses not just from the demo repo.

Close #730
This commit is contained in:
Régis Behmo 2023-03-26 10:24:09 -04:00 committed by Régis Behmo
parent 9feab4c0c3
commit b3c5c9685b
2 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1 @@
- [Feature] Make it possible to import the demo course from a different git repository or version. (by @regisb)

View File

@ -139,11 +139,26 @@ u.save()"
@click.command(help="Import the demo course")
def importdemocourse() -> t.Iterable[tuple[str, str]]:
template = """
@click.option(
"-r",
"--repo",
default="https://github.com/openedx/edx-demo-course",
show_default=True,
help="Git repository that contains the course to be imported",
)
@click.option(
"-v",
"--version",
help="Git branch, tag or sha1 identifier. If unspecified, will default to the value of the OPENEDX_COMMON_VERSION setting.",
)
def importdemocourse(
repo: str, version: t.Optional[str]
) -> t.Iterable[tuple[str, str]]:
version = version or "{{ OPENEDX_COMMON_VERSION }}"
template = f"""
# Import demo course
git clone https://github.com/openedx/edx-demo-course --branch {{ OPENEDX_COMMON_VERSION }} --depth 1 ../edx-demo-course
python ./manage.py cms import ../data ../edx-demo-course
git clone {repo} --branch {version} --depth 1 /tmp/course
python ./manage.py cms import ../data /tmp/course
# Re-index courses
./manage.py cms reindex_course --all --setup"""