Skip to content

Commit

Permalink
feat: hid the learner pathway API behind a django setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
saleem-latif committed Dec 1, 2021
1 parent a617740 commit 333fe92
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 42 deletions.
27 changes: 26 additions & 1 deletion course_discovery/apps/learner_pathway/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.8 on 2021-11-26 13:17
# Generated by Django 3.2.8 on 2021-12-01 09:04

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -10,6 +10,7 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('course_metadata', '0266_auto_20210624_1831'),
]

operations = [
Expand All @@ -29,4 +30,28 @@ class Migration(migrations.Migration):
('pathway', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='steps', to='learner_pathway.learnerpathway')),
],
),
migrations.CreateModel(
name='LearnerPathwayProgram',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')),
('program', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='learner_pathway_programs', to='course_metadata.program')),
('step', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='learner_pathway.learnerpathwaystep')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='LearnerPathwayCourse',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True, verbose_name='UUID')),
('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='learner_pathway_courses', to='course_metadata.course')),
('step', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='learner_pathway.learnerpathwaystep')),
],
options={
'abstract': False,
},
),
]

This file was deleted.

4 changes: 4 additions & 0 deletions course_discovery/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,7 @@
################################### END CELERY ###################################

FIRE_UPDATE_COURSE_SKILLS_SIGNAL = False

# Learner Pathway
# Disable learner pathway on all environment except devstack and testing.
ENABLE_LEARNER_PATHWAY = False
4 changes: 4 additions & 0 deletions course_discovery/settings/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,7 @@
# Lastly, see if the developer has any local overrides.
if os.path.isfile(join(dirname(abspath(__file__)), 'private.py')):
from .private import * # pylint: disable=import-error

# Learner Pathway
# Disable learner pathway on all environment except devstack and testing.
ENABLE_LEARNER_PATHWAY = True
4 changes: 4 additions & 0 deletions course_discovery/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@
CELERY_BROKER_URL = 'memory://localhost/'

################################### END CELERY ###################################

# Learner Pathway
# Disable learner pathway on all environment except devstack and testing.
ENABLE_LEARNER_PATHWAY = True
6 changes: 5 additions & 1 deletion course_discovery/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
url(r'^admin/course_metadata/', include('course_discovery.apps.course_metadata.urls', namespace='admin_metadata')),
url(r'^admin/', admin.site.urls),
url(r'^api/', include('course_discovery.apps.api.urls', namespace='api')),
url(r'^api/', include('course_discovery.apps.learner_pathway.api.urls', namespace='learner_pathway_api')),
# Use the same auth views for all logins, including those originating from the browseable API.
url(r'^api-auth/', include((oauth2_urlpatterns, 'rest_framework'))),
url(r'^api-docs/$', schema_view.with_ui('swagger', cache_timeout=0), name='api_docs'),
Expand All @@ -60,6 +59,11 @@
url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
]

if settings.ENABLE_LEARNER_PATHWAY:
urlpatterns += [
url(r'^api/', include('course_discovery.apps.learner_pathway.api.urls', namespace='learner_pathway_api')),
]

# edx-drf-extensions csrf app
urlpatterns += [
url(r'', include('csrf.urls')),
Expand Down

0 comments on commit 333fe92

Please sign in to comment.