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:
parent
9feab4c0c3
commit
b3c5c9685b
1
changelog.d/20230326_102311_regis_moar_tasks.md
Normal file
1
changelog.d/20230326_102311_regis_moar_tasks.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- [Feature] Make it possible to import the demo course from a different git repository or version. (by @regisb)
|
@ -139,11 +139,26 @@ u.save()"
|
|||||||
|
|
||||||
|
|
||||||
@click.command(help="Import the demo course")
|
@click.command(help="Import the demo course")
|
||||||
def importdemocourse() -> t.Iterable[tuple[str, str]]:
|
@click.option(
|
||||||
template = """
|
"-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
|
# Import demo course
|
||||||
git clone https://github.com/openedx/edx-demo-course --branch {{ OPENEDX_COMMON_VERSION }} --depth 1 ../edx-demo-course
|
git clone {repo} --branch {version} --depth 1 /tmp/course
|
||||||
python ./manage.py cms import ../data ../edx-demo-course
|
python ./manage.py cms import ../data /tmp/course
|
||||||
|
|
||||||
# Re-index courses
|
# Re-index courses
|
||||||
./manage.py cms reindex_course --all --setup"""
|
./manage.py cms reindex_course --all --setup"""
|
||||||
|
Loading…
Reference in New Issue
Block a user