Commit 82d9dcd5 by Clinton Blackburn Committed by Clinton Blackburn

Added edx_catalog_extensions and ProgramType migrations

- The edx_catalog_extensions app contains edX-specific data/migrations.
- Initial migration creates XSeries and MicroMasters program types

ECOM-5173
parent fd3c38ca
...@@ -23,7 +23,7 @@ before_install: ...@@ -23,7 +23,7 @@ before_install:
install: install:
- pip install -U pip wheel codecov - pip install -U pip wheel codecov
- pip install -r requirements/test.txt - make requirements
- make requirements.js - make requirements.js
before_script: before_script:
...@@ -31,6 +31,11 @@ before_script: ...@@ -31,6 +31,11 @@ before_script:
- sleep 10 - sleep 10
script: script:
# Ensure documentation can be compiled
- cd docs && make html
- cd ..
# Compile static assets and validate the code
- make static -e DJANGO_SETTINGS_MODULE="course_discovery.settings.test" - make static -e DJANGO_SETTINGS_MODULE="course_discovery.settings.test"
- make validate - make validate
......
""" edX extensions for the Catalog (Course Discovery) Service.
This Django app is intended for usage by edX. Its usage is NOT supported for OpenEdX.
"""
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
PAID_SEAT_TYPES = ('credit', 'professional', 'verified',)
PROGRAM_TYPES = ('XSeries', 'MicroMasters',)
def add_program_types(apps, schema_editor):
SeatType = apps.get_model('course_metadata', 'SeatType')
ProgramType = apps.get_model('course_metadata', 'ProgramType')
seat_types = SeatType.objects.filter(slug__in=PAID_SEAT_TYPES)
for name in PROGRAM_TYPES:
program_type, __ = ProgramType.objects.update_or_create(name=name)
program_type.applicable_seat_types.clear()
program_type.applicable_seat_types.add(*seat_types)
program_type.save()
def drop_program_types(apps, schema_editor):
ProgramType = apps.get_model('course_metadata', 'ProgramType')
ProgramType.objects.filter(name__in=PROGRAM_TYPES).delete()
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0012_create_seat_types'),
]
operations = [
migrations.RunPython(add_program_types, drop_program_types)
]
# The bare minimum needed for Sphinx to import each file and generate documentation. # The bare minimum needed for Sphinx to import each file and generate documentation.
from course_discovery.settings.base import INSTALLED_APPS # noinspection PyUnresolvedReferences
from course_discovery.settings.base import *
DATABASES = { DATABASES = {
'default': { 'default': {
......
...@@ -3,6 +3,7 @@ from course_discovery.settings.base import * ...@@ -3,6 +3,7 @@ from course_discovery.settings.base import *
# TEST SETTINGS # TEST SETTINGS
INSTALLED_APPS += ( INSTALLED_APPS += (
'django_nose', 'django_nose',
'course_discovery.apps.edx_catalog_extensions',
) )
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
......
.. _edx-extensions:
edX Extensions
==============
edX.org has its own app, ``edx_catalog_extensions``, to contain edX-specific customizations. These include data
migrations, management commands, etc. specific to edX. Non-edX users should NOT use this app. This app
is explicitly disabled by default in all non-test environments.
At some point in the future this app will be moved to a separate repository to avoid confusion. It exists here now
until we can determine what other edX-specific components need to be extracted from the general project.
edX developers should add ``'course_discovery.apps.edx_catalog_extensions'`` to the ``INSTALLED_APPS`` setting in a
``private.py`` settings file.
...@@ -30,6 +30,8 @@ When developing locally, it may be useful to have settings overrides that you do ...@@ -30,6 +30,8 @@ When developing locally, it may be useful to have settings overrides that you do
If you need such overrides, create a file :file:`course_discovery/settings/private.py`. This file's values are If you need such overrides, create a file :file:`course_discovery/settings/private.py`. This file's values are
read by :file:`course_discovery/settings/local.py`, but ignored by Git. read by :file:`course_discovery/settings/local.py`, but ignored by Git.
If you are an edX employee/developer, see :ref:`edx-extensions`.
Configure edX OpenID Connect (OIDC) Configure edX OpenID Connect (OIDC)
----------------------------------- -----------------------------------
......
...@@ -18,3 +18,4 @@ A service for serving course discovery and marketing information to partners, mo ...@@ -18,3 +18,4 @@ A service for serving course discovery and marketing information to partners, mo
testing testing
features features
internationalization internationalization
edx_extensions
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment