lms.djangoapps.program_enrollments package

Contents

lms.djangoapps.program_enrollments package#

Subpackages#

Submodules#

lms.djangoapps.program_enrollments.apps module#

ProgramEnrollments Application Configuration

class lms.djangoapps.program_enrollments.apps.ProgramEnrollmentsConfig(app_name, app_module)#

Bases: AppConfig

Application configuration for ProgramEnrollment

name = 'lms.djangoapps.program_enrollments'#
plugin_app = {'url_config': {'lms.djangoapp': {'app_name': 'lms.djangoapps.program_enrollments', 'namespace': 'programs_api', 'regex': 'api/program_enrollments/', 'relative_path': 'rest_api.urls'}}}#
ready()#

Connect handlers to signals.

lms.djangoapps.program_enrollments.constants module#

Constants used throughout the program_enrollments app and exposed to other in-process apps through api.py.

class lms.djangoapps.program_enrollments.constants.ProgramCourseEnrollmentRoles#

Bases: object

Valid roles that can be assigned as part of a ProgramCourseEnrollment

COURSE_STAFF = 'staff'#
class lms.djangoapps.program_enrollments.constants.ProgramCourseEnrollmentStatuses#

Bases: object

Status that a user may have enrolled in a course.

TODO: Consider whether we need these (EDUCATOR-4958)

ACTIVE = 'active'#
INACTIVE = 'inactive'#
class lms.djangoapps.program_enrollments.constants.ProgramCourseOperationStatuses#

Bases: ProgramCourseEnrollmentStatuses, _EnrollmentErrorStatuses

Valid program-course enrollment operation statuses.

Combines error statuses and OK statuses.

NOT_FOUND = 'not-found'#
class lms.djangoapps.program_enrollments.constants.ProgramEnrollmentStatuses#

Bases: object

Status that a user may have enrolled in a program.

TODO: Define the semantics of each of these (EDUCATOR-4958)

CANCELED = 'canceled'#
ENDED = 'ended'#
ENROLLED = 'enrolled'#
PENDING = 'pending'#
SUSPENDED = 'suspended'#
class lms.djangoapps.program_enrollments.constants.ProgramOperationStatuses#

Bases: ProgramEnrollmentStatuses, _EnrollmentErrorStatuses

Valid program enrollment operation statuses.

Combines error statuses and OK statuses.

lms.djangoapps.program_enrollments.exceptions module#

Exceptions raised by functions exposed by program_enrollments Django app.

exception lms.djangoapps.program_enrollments.exceptions.BadOrganizationShortNameException(organization_short_name)#

Bases: OrganizationDoesNotExistException

exception lms.djangoapps.program_enrollments.exceptions.OrganizationDoesNotExistException#

Bases: Exception

exception lms.djangoapps.program_enrollments.exceptions.ProgramDoesNotExistException(program_uuid)#

Bases: Exception

exception lms.djangoapps.program_enrollments.exceptions.ProgramHasNoAuthoringOrganizationException(program_uuid)#

Bases: OrganizationDoesNotExistException

exception lms.djangoapps.program_enrollments.exceptions.ProviderDoesNotExistException(organization)#

Bases: Exception

lms.djangoapps.program_enrollments.models module#

Django model specifications for the Program Enrollments API

class lms.djangoapps.program_enrollments.models.CourseAccessRoleAssignment(*args, **kwargs)#

Bases: TimeStampedModel

This model represents a role that should be assigned to the eventual user of a pending enrollment.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

enrollment#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

enrollment_id#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
get_role_display(*, field=<django.db.models.fields.CharField: role>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
role#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class lms.djangoapps.program_enrollments.models.ProgramCourseEnrollment(*args, **kwargs)#

Bases: TimeStampedModel

This is a model to represent a learner’s enrollment in a course in the context of a program from the registrar service

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

STATUS_CHOICES = <generator object ProgramCourseEnrollmentStatuses.<genexpr>>#
course_enrollment#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

course_enrollment_id#
course_key#

DO NOT REUSE THIS CLASS. Provided for backwards compatibility only!

A placeholder class that provides a way to set the attribute on the model.

courseaccessroleassignment_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
get_status_display(*, field=<django.db.models.fields.CharField: status>)#
historical_records = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property is_active#
modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
program_enrollment#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

program_enrollment_id#
save_without_historical_record(*args, **kwargs)#

Save the model instance without creating a historical record.

Make sure you know what you’re doing before using this method.

status#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class lms.djangoapps.program_enrollments.models.ProgramEnrollment(*args, **kwargs)#

Bases: TimeStampedModel

This is a model for Program Enrollments from the registrar service

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

STATUS_CHOICES = <generator object ProgramEnrollmentStatuses.<genexpr>>#
clean()#

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

curriculum_uuid#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

external_user_key#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
get_status_display(*, field=<django.db.models.fields.CharField: status>)#
historical_records = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
program_course_enrollments#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

program_uuid#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

classmethod retire_user(user_id)#

With the parameter user_id, retire the external_user_key field

Return True if there is data that was retired Return False if there is no matching data

save_without_historical_record(*args, **kwargs)#

Save the model instance without creating a historical record.

Make sure you know what you’re doing before using this method.

status#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

user_id#

lms.djangoapps.program_enrollments.signals module#

Signal handlers for program enrollments

lms.djangoapps.program_enrollments.signals.generate_default_display_name(self)#

Returns a default display name for SamlProviderConfig.

lms.djangoapps.program_enrollments.signals.listen_for_social_auth_creation(sender, instance, created, **kwargs)#

Post-save signal that will attempt to link a social auth entry with waiting enrollments

lms.djangoapps.program_enrollments.signals.matriculate_learner(user, uid)#

Update any waiting program enrollments with a user, and enroll the user in any waiting course enrollments.

In most cases this will just short-circuit. Enrollments will only be updated for a SAML provider with a linked organization.

lms.djangoapps.program_enrollments.signals.save_default_display_name(sender, instance, **kwargs)#

Post-save signal that sets default display name if one is not provided

lms.djangoapps.program_enrollments.tasks module#

Tasks for program enrollments

Module contents#