[BB-1506] Use a callable as the default value for CourseEnrollment.mode

Description

The previous behaviour of using a variable causes Django to complain
about changes not reflected in a migration when the default course
mode slug is changed.

*JIRA tickets*: If there is a related publicly viewable JIRA ticket, mention that here. Also mention the OSPR ticket
number here once it gets created (after you open the PR), if applicable. Otherwise omit this.

*Dependencies*: None

*Sandbox URL*: TBD - sandbox is being provisioned.

*Merge deadline*: None

*Testing instructions*:
1. In the `master` devstack, set the `COURSE_MODE_DEFAULTS` variable in the LMS configuration file (`/edx/etc/lms.yml`) with values like below.

```
COURSE_MODE_DEFAULTS:
bulk_sku: null
currency: 'usd'
description: null
expiration_datetime: null
min_price: 0
name: 'Honor'
sku: None
slug: 'honor'
suggested_prices: ''
```
2. Restart LMS.
3. Run `python manage.py lms makemigrations student`. A new migration will be created for the `CourseEnrollment` model setting the default value for the `mode` field to `"honor"`.
4. Repeat steps 1 to 3 with the source branch of this PR. There should be no additional migrations created with value of slug set to `'audit'` (the default), `'honor'` or any other mode slug.

*Reviewers*

  • [ ] @giovannicimolin

  • [ ] edX reviewer[s] TBD

*Settings*
```yaml
EDXAPP_ENV_EXTRA:
COURSE_MODE_DEFAULTS:
bulk_sku: null
currency: 'usd'
description: null
expiration_datetime: null
min_price: 0
name: 'Honor'
sku: None
slug: 'honor'
suggested_prices: ''
```

Status

Assignee

Unassigned

Reporter

Open Source Pull Request Bot

Labels

Contributor Name

Guruprasad Lakshmi Narayanan

Repo

edx/edx-platform

Customer

Epic Link

None

OSCM Assignee

None

Priority

Unset
Configure