enterprise package#

Subpackages#

Submodules#

enterprise.apps module#

Enterprise Django application initialization.

class enterprise.apps.EnterpriseConfig(app_name, app_module)#

Bases: AppConfig

Configuration for the enterprise Django application.

property auth_user_model#

Return User model for django.contrib.auth.

backend_service_edx_oauth2_key = 'test_backend_oauth2_key'#
backend_service_edx_oauth2_provider_url = 'http://localhost:8000/oauth2'#
backend_service_edx_oauth2_secret = 'test_backend_oauth2_secret'#
customer_success_email = 'customersuccess@edx.org'#
enterprise_integrations_email = 'enterprise-integrations@edx.org'#
name = 'enterprise'#
ready()#

Perform other one-time initialization steps.

valid_image_extensions = ['.png']#
valid_max_image_size = 512#

enterprise.constants module#

Enterprise Django application constants.

class enterprise.constants.CourseModes#

Bases: object

Class to group modes that a course might have.

AUDIT = 'audit'#
CREDIT = 'credit'#
HONOR = 'honor'#
NO_ID_PROFESSIONAL = 'no-id-professional'#
PROFESSIONAL = 'professional'#
UNPAID_EXECUTIVE_EDUCATION = 'unpaid-executive-education'#
VERIFIED = 'verified'#
class enterprise.constants.DefaultColors#

Bases: object

Class to group the default branding color codes. These color codes originated in the Enterprise Learner Portal.

PRIMARY = '#2D494E'#
SECONDARY = '#F2F0EF'#
TERTIARY = '#D23228'#
class enterprise.constants.FulfillmentTypes#

Bases: object

CHOICES = [('license', 'License'), ('learner_credit', 'Learner credit'), ('coupon_code', 'Coupon code')]#
COUPON_CODE = 'coupon_code'#
LEARNER_CREDIT = 'learner_credit'#
LICENSE = 'license'#
enterprise.constants.json_serialized_course_modes()#
Returns:

serialized course modes.

enterprise.decorators module#

Decorators for enterprise app.

enterprise.decorators.deprecated(extra)#

Flag a method as deprecated.

Parameters:

extra – Extra text you’d like to display after the default text.

enterprise.decorators.disable_for_loaddata(signal_handler)#

Use this decorator to turn off signal handlers when loading fixture data.

Django docs instruct to avoid further changes to the DB if raw=True as it might not be in a consistent state. See https://docs.djangoproject.com/en/dev/ref/signals/#post-save

enterprise.decorators.enterprise_login_required(view)#

View decorator for allowing authenticated user with valid enterprise UUID.

This decorator requires enterprise identifier as a parameter enterprise_uuid.

This decorator will throw 404 if no kwarg enterprise_uuid is provided to the decorated view .

If there is no enterprise in database against the kwarg enterprise_uuid or if the user is not authenticated then it will redirect the user to the enterprise-linked SSO login page.

Usage:

@enterprise_login_required()
def my_view(request, enterprise_uuid):
    # Some functionality ...

OR

class MyView(View):
    ...
    @method_decorator(enterprise_login_required)
    def get(self, request, enterprise_uuid):
        # Some functionality ...
enterprise.decorators.force_fresh_session(view)#

View decorator which terminates stale TPA sessions.

This decorator forces the user to obtain a new session the first time they access the decorated view. This prevents TPA-authenticated users from hijacking the session of another user who may have been previously logged in using the same browser window.

This decorator should be used in conjunction with the enterprise_login_required decorator.

Usage:

@enterprise_login_required
@force_fresh_session()
def my_view(request, enterprise_uuid):
    # Some functionality ...

OR

class MyView(View):
    ...
    @method_decorator(enterprise_login_required)
    @method_decorator(force_fresh_session)
    def get(self, request, enterprise_uuid):
        # Some functionality ...
enterprise.decorators.ignore_warning(warning)#

Ignore any emitted warnings from a function.

Parameters:

warning – The category of warning to ignore.

enterprise.decorators.null_decorator(func)#

Use this decorator to stub out decorators for testing.

If we’re unable to import social_core.pipeline.partial, which is the case in our CI platform, we need to be able to wrap the function with something.

enterprise.errors module#

Errors thrown by the APIs in the Enterprise application.

exception enterprise.errors.AdminNotificationAPIRequestError#

Bases: Exception

An exception that represents an error when creating admin notification read status via the NotificationReadApiClient.

exception enterprise.errors.CodesAPIRequestError#

Bases: Exception

There was a problem with a request to the Codes application’s APIs.

exception enterprise.errors.EnrollmentModificationException#

Bases: Exception

An exception that represents an error when modifying the state of an enrollment via the EnrollmentApiClient.

exception enterprise.errors.LinkUserToEnterpriseError#

Bases: Exception

An error occurred while linking a user to an enterprise.

exception enterprise.errors.UnlinkUserFromEnterpriseError#

Bases: Exception

An error occurred while unlinking a user from an enterprise.

enterprise.forms module#

User-facing forms for the Enterprise app.

class enterprise.forms.EnterpriseLoginForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None)#

Bases: Form

Enterprise Slug Login Form.

base_fields = {'enterprise_slug': <django.forms.fields.CharField object>}#
clean()#

Validate POST data.

declared_fields = {'enterprise_slug': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

class enterprise.forms.EnterpriseSelectionForm(*args, **kwargs)#

Bases: Form

Enterprise Selection Form.

base_fields = {'enterprise': <django.forms.fields.ChoiceField object>, 'success_url': <django.forms.fields.CharField object>}#
clean()#

Validate POST data.

declared_fields = {'enterprise': <django.forms.fields.ChoiceField object>, 'success_url': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

enterprise.logging module#

Logging utilities for Enterprise

class enterprise.logging.EnterpriseRequestIdLoggerAdapter(logger, extra)#

Bases: LoggerAdapter

A utility for logging X-Request-ID information https://docs.python.org/3/howto/logging-cookbook.html#using-loggeradapters-to-impart-contextual-information

process(msg, kwargs)#

Process the logging message and keyword arguments passed in to a logging call to insert contextual information. You can either manipulate the message itself, the keyword args or both. Return the message and kwargs modified (or not) to suit your needs.

Normally, you’ll only need to override this one method in a LoggerAdapter subclass for your specific needs.

enterprise.logging.getEnterpriseLogger(name)#

Get an Enterprise-ready logger

enterprise.logging.get_request_id()#

Helper to get the request id - usually set via an X-Request-ID header

enterprise.messages module#

Utility functions for interfacing with the Django messages framework.

Add a message to the Django messages store indicating that the user has declined data sharing consent.

Parameters:
  • request (HttpRequest) – The current request.

  • enterprise_customer (EnterpriseCustomer) – The EnterpriseCustomer associated with this request.

  • item (str) – A string containing information about the item for which consent was declined.

enterprise.messages.add_generic_error_message_with_code(request, error_code)#

Add message to request indicating that there was an issue processing request.

Parameters:
  • request – The current request.

  • error_code – A string error code to be used to point devs to the spot in the code where this error occurred.

enterprise.messages.add_missing_price_information_message(request, item)#

Add a message to the Django messages store indicating that we failed to retrieve price information about an item.

Parameters:
  • request – The current request.

  • item – The item for which price information is missing. Example: a program title, or a course.

enterprise.messages.add_unenrollable_item_message(request, item)#

Add a message to the Django message store indicating that the item (i.e. course run, program) is unenrollable.

Parameters:
  • request – The current request.

  • item – The item that is unenrollable (i.e. a course run).

enterprise.middleware module#

Middleware for enterprise app.

class enterprise.middleware.EnterpriseLanguagePreferenceMiddleware(get_response)#

Bases: MiddlewareMixin

Middleware for enterprise language preference.

Ensures that, once set, a user’s preferences are reflected in the page whenever they are logged in.

process_request(request)#
Perform the following checks
  1. Check that the user is authenticated and belongs to an enterprise customer.

  2. Check that the enterprise customer has a language set via the default_language column on

    EnterpriseCustomer model.

  3. Check that user has not set a language via its account settings page.

If all the above checks are satisfied then set request._anonymous_user_cookie_lang to the default_language of EnterpriseCustomer model instance. This attribute will later be used by the LanguagePreferenceMiddleware middleware for setting the user preference. Since, this middleware relies on LanguagePreferenceMiddleware so it must always be followed by LanguagePreferenceMiddleware. Otherwise, it will not work.

enterprise.models module#

Database models for enterprise.

class enterprise.models.AdminNotification(*args, **kwargs)#

Bases: TimeStampedModel

Model for Admin Notification.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

admin_notification_filter#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

adminnotificationread_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.

expiration_date#

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_expiration_date(*, field=<django.db.models.fields.DateField: expiration_date>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)#
get_next_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)#
get_previous_by_expiration_date(*, field=<django.db.models.fields.DateField: expiration_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
get_previous_by_start_date(*, field=<django.db.models.fields.DateField: start_date>, is_next=False, **kwargs)#
id#

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

is_active#

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>#
start_date#

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

text#

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

title#

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

class enterprise.models.AdminNotificationFilter(*args, **kwargs)#

Bases: TimeStampedModel

Model for Admin Notification Filters.

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.

filter#

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)#
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.

notification_filter#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

objects = <django.db.models.manager.Manager object>#
class enterprise.models.AdminNotificationRead(*args, **kwargs)#

Bases: TimeStampedModel

Model for Admin Notification Read Status.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

admin_notification#

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.

admin_notification_id#
created#

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

enterprise_customer_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.

enterprise_customer_user_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)#
id#

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

is_read#

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>#
class enterprise.models.BulkCatalogQueryUpdateCommandConfiguration(*args, **kwargs)#

Bases: ConfigurationModel

Manages configuration for a run of the cert_generation management command.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

arguments#

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

change_date#

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

changed_by#

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.

changed_by_id#
enabled#

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_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=True, **kwargs)#
get_previous_by_change_date(*, field=<django.db.models.fields.DateTimeField: change_date>, is_next=False, **kwargs)#
id#

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

class enterprise.models.ChatGPTResponse(*args, **kwargs)#

Bases: TimeStampedModel

Stores ChatGPT prompts and their responses for each enterprise customer.

exception DoesNotExist#

Bases: ObjectDoesNotExist

LEARNER_ENGAGEMENT = 'learner_engagement'#
LEARNER_PROGRESS = 'learner_progress'#
exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

PROMPT_TYPES = [('learner_progress', 'Learner progress'), ('learner_engagement', 'Learner engagement')]#
created#

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

enterprise_customer#

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.

enterprise_customer_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)#
classmethod get_or_create(prompt, role, enterprise_customer, prompt_type)#

Get or create ChatGPT response against given prompt.

This method will first check and return the entry against the given prompt exist in the current table, if no such entry exists, it will call OpenAI API and save and return the entry.

Parameters:
  • prompt (str) – OpenAI prompt.

  • role (str) – ChatGPT role to assume for the prompt.

  • enterprise_customer (EnterpriseCustomer) – Enterprise customer UUId making the request.

  • prompt_type (str) – Prompt type, e.g. learner_progress or learner_engagement etc.

Returns:

Response against the given prompt.

Return type:

(str)

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_prompt_type_display(*, field=<django.db.models.fields.CharField: prompt_type>)#
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>#
prompt#

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

prompt_hash#

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

prompt_type#

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

response#

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

save(*args, **kwargs)#

Set the value of prompt_hash before saving.

uuid#

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

class enterprise.models.EnrollmentNotificationEmailTemplate(*args, **kwargs)#

Bases: TimeStampedModel

Store optional templates to use when emailing users about course enrollment events.

BODY_HELP_TEXT = 'Fill in a standard Django template that, when rendered, produces the email you want sent to newly-enrolled Enterprise Customer learners. The following variables may be available:\n<ul><li>user_name: A human-readable name for the person being emailed. Be sure to handle the case where this is not defined, as it may be missing in some cases. It may also be a username, if the learner hasn\'t configured their "real" name in the system.</li>    <li>organization_name: The name of the organization sponsoring the enrollment.</li>    <li>enrolled_in: Details of the course or program that was enrolled in. It may contain:    <ul><li>name: The name of the enrollable item (e.g., "Demo Course").</li>        <li>url: A link to the homepage of the enrolled-in item.</li>        <li>branding: A custom branding name for the enrolled-in item. For example, the branding of a MicroMasters program would be "MicroMasters".</li>     <li>start: The date the enrolled-in item becomes available. Render this to text using the Django `date` template filter (see <a href="https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#date">the Django documentation</a>).</li><li>type: Whether the enrolled-in item is a course, a program, or something else.</li></ul></ul>'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

SUBJECT_HELP_TEXT = 'Enter a string that can be used to generate a dynamic subject line for notification emails. The placeholder {course_name} will be replaced with the name of the course or program that was enrolled in.'#
created#

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

enterprise_customer#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_customer_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_template_type_display(*, field=<django.db.models.fields.CharField: template_type>)#
history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
html_template#

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

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>#
plaintext_template#

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

render_all_templates(kwargs)#

Render both templates and return both.

render_html_template(kwargs)#

Render just the HTML template and return it as a string.

render_plaintext_template(kwargs)#

Render just the plaintext template and return it as a string.

render_template(template_text, kwargs)#

Create a template from the DB-backed text and render it.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

subject_line#

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

template_type#

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

template_type_choices = [('SELF_ENROLL', 'Self Enrollment Template'), ('ADMIN_ENROLL', 'Admin Enrollment Template')]#
class enterprise.models.EnterpriseCatalogQuery(*args, **kwargs)#

Bases: TimeStampedModel

Stores a re-usable catalog query.

This stored catalog query used in EnterpriseCustomerCatalog objects to build catalog’s content_filter field. This is a saved instance of content_filter that can be re-used across different catalogs.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

content_filter#

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

created#

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

delete(*args, **kwargs)#

Deletes this EnterpriseCatalogQuery.

enterprise_customer_catalogs#

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.

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)#
id#

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

include_exec_ed_2u_courses#

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>#
title#

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

uuid#

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

class enterprise.models.EnterpriseCourseEnrollment(*args, **kwargs)#

Bases: TimeStampedModel

Store information about the enrollment of a user in a course.

This model is the central source of truth for information about whether a particular user, linked to a particular EnterpriseCustomer, has been enrolled in a course, and is the repository for any other relevant metadata about such an enrollment.

Do not delete records of this model - there are downstream business reporting processes that rely them, even if the underlying student.CourseEnrollment record has been marked inactive/un-enrolled. As a consequence, the only way to determine if a given EnterpriseCourseEnrollment is currently active is to examine the is_active field of the associated student.CourseEnrollment.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

property audit_reporting_disabled#

Specify whether audit track data reporting is disabled for this enrollment.

  • If the enterprise customer associated with this enrollment enables audit track data reporting, simply return False.

  • If the enterprise customer associated with this enrollment does not enable audit track data reporting, return True if we are dealing with an audit enrollment, and False otherwise.

Returns:

True if audit track data reporting is disabled, False otherwise.

course_enrollment#

Returns the student.CourseEnrollment associated with this enterprise course enrollment record.

course_id#

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

created#

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

enterprise_customer_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.

enterprise_customer_user_id#
classmethod get_enterprise_course_enrollment_id(user, course_id, enterprise_customer)#

Return the EnterpriseCourseEnrollment object for a given user in given course_id.

classmethod get_enterprise_uuids_with_user_and_course(user_id, course_run_id, is_customer_active=None)#

Returns a list of UUID(s) for EnterpriseCustomer(s) that this enrollment links together with the user_id and course_run_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)#
history = <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#

Returns True iff this enrollment is currently active.

property is_audit_enrollment#

Specify whether the course enrollment associated with this EnterpriseCourseEnrollment is in audit mode.

Returns:

Whether the course enrollment mode is of an audit type.

learnercreditenterprisecourseenrollment_enrollment_fulfillment#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property license#

Returns the license associated with this enterprise course enrollment if one exists.

licensedenterprisecourseenrollment_enrollment_fulfillment#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

property mode#

Returns the mode of the student.CourseEnrollment associated with this enterprise course enrollment record.

modified#

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

objects = <enterprise.models.EnterpriseCourseEnrollmentManager object>#
save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

saved_for_later#

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

source#

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.

source_id#
unenrolled#

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

unenrolled_at#

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

with_additional_fields = <enterprise.models.EnterpriseCourseEnrollmentWithAdditionalFieldsManager object>#
class enterprise.models.EnterpriseCourseEnrollmentManager(*args, **kwargs)#

Bases: Manager

Model manager for EnterpriseCourseEnrollment.

get_queryset()#

Override to return only those enrollment records for which learner is linked to an enterprise.

class enterprise.models.EnterpriseCourseEnrollmentWithAdditionalFieldsManager(*args, **kwargs)#

Bases: Manager

Model manager for EnterpriseCourseEnrollment.

get_queryset()#

Override to return only those enrollment records for which learner is linked to an enterprise.

class enterprise.models.EnterpriseCourseEntitlement(*args, **kwargs)#

Bases: TimeStampedModel

Store the information about the entitlement of an enterprise user for a course

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

course_entitlement#

Returns the CourseEntitlement associated with this enterprise course entitlement record.

course_uuid#

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

created#

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

enterprise_customer_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.

enterprise_customer_user_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)#
history = <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.

learnercreditenterprisecourseenrollment_entitlement_fulfillment#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

licensedenterprisecourseenrollment_entitlement_fulfillment#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

modified#

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

objects = <enterprise.models.EnterpriseCourseEntitlementManager object>#
save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

uuid#

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

class enterprise.models.EnterpriseCourseEntitlementManager(*args, **kwargs)#

Bases: Manager

Model manager for EnterpriseCourseEntitlement.

get_queryset()#

Override to return only those entitlment records for which learner is linked to an enterprise.

class enterprise.models.EnterpriseCustomer(*args, **kwargs)#

Bases: TimeStampedModel

Enterprise Customer is an organization or a group of people that “consumes” courses.

Users associated with an Enterprise Customer take courses on the edX platform.

Enterprise Customer might be providing certain benefits to their members, like discounts to paid course enrollments, and also might request (or require) sharing learner results with them.

Fields:
  • uuid (UUIDField, PRIMARY KEY) – Enterprise Customer code - used to reference this Enterprise Customer in other parts of the system (SSO, ecommerce, analytics etc.).

  • name (django.db.models.CharField) – Enterprise Customer name.

  • active (django.db.models.BooleanField) – used to mark inactive Enterprise Customers - implements “soft delete” pattern.

AT_ENROLLMENT = 'at_enrollment'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

EXTERNALLY_MANAGED = 'externally_managed'#
exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

active#

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

active_customers = <enterprise.models.EnterpriseCustomerManager object>#
auth_org_id#

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

blackboardenterprisecustomerconfiguration_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.

branding_configuration#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

canvasenterprisecustomerconfiguration_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.

career_engagement_network_message#

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

catalog_contains_course(course_run_id)#

Determine if the specified course run is contained in enterprise customer catalogs.

Parameters:

course_run_id (str) – The string ID of the course or course run in question

Returns:

Whether the enterprise catalog includes the given course run.

Return type:

bool

chat_gpt_prompts#

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.

clear_pending_registration(email, *course_ids)#

Clear pending enrollments for the user in the given courses.

Parameters:
  • email – The email address which may have previously been used.

  • course_ids – An iterable containing any number of course IDs.

contact_email#

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

contentmetadataitemtransmission_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.

cornerstoneenterprisecustomerconfiguration_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.

country#

A descriptor for country fields on a model instance. Returns a Country when accessed so you can do things like:

>>> from people import Person
>>> person = Person.object.get(name='Chris')

>>> person.country.name
'New Zealand'

>>> person.country.flag
'/static/flags/nz.gif'
created#

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

customer_type#

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.

customer_type_id#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

default_contract_discount#

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

default_language#

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

property default_provider_idp#

Return default_provider if associated with this enterprise customer.

degreed2enterprisecustomerconfiguration_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.

degreedenterprisecustomerconfiguration_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.

enable_academies#

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

enable_analytics_screen#

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

enable_audit_data_reporting#

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

enable_audit_enrollment#

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

enable_autocohorting#

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

enable_browse_and_request#

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

enable_career_engagement_network_on_learner_portal#

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

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

enable_demo_data_for_analytics_and_lpr#

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

enable_executive_education_2U_fulfillment#

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

enable_generation_of_api_credentials#

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

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

enable_learner_portal#

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

enable_learner_portal_offers#

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

enable_one_academy#

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

enable_pathways#

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

enable_portal_code_management_screen#

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

enable_portal_learner_credit_management_screen#

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

enable_portal_lms_configurations_screen#

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

enable_portal_reporting_config_screen#

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

enable_portal_saml_configuration_screen#

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

enable_portal_subscription_management_screen#

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

enable_programs#

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

enable_slug_login#

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

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

property enables_audit_data_reporting#

Determine whether the enterprise customer has enabled the ability to report/pass-back audit track data.

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

Determine whether the enterprise customer enforce data sharing consent at the given point.

Parameters:
  • enforcement_location (str) – the point where to see data sharing consent state.

  • 'externally_managed' (argument can either be 'at_enrollment' or) –

enroll_user_pending_registration(email, course_mode, *course_ids, **kwargs)#

Create pending enrollments for the user in any number of courses, which will take effect on registration.

Parameters:
  • email – The email address for the pending link to be created

  • course_mode – The mode with which the eventual enrollment should be created

  • *course_ids – An iterable containing any number of course IDs to eventually enroll the user in.

  • cohort (optional) – name of cohort to assign

Returns:

The PendingEnterpriseCustomerUser attached to the email address

enroll_user_pending_registration_with_status(email, course_mode, *course_ids, **kwargs)#

Create pending enrollments for the user in any number of courses, which will take effect on registration. Return a dictionary representing status of submitted enrollments.

Parameters:
  • email – The email address for the pending link to be created

  • course_mode – The mode with which the eventual enrollment should be created

  • *course_ids – An iterable containing any number of course IDs to eventually enroll the user in.

  • cohort (optional) – name of cohort to assign

Returns:

The PendingEnterpriseCustomerUser attached to the email address new_enrollments (Dict): course ID keys and new enrollment status values.

enterprise_customer_catalogs#

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.

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.

property enterprise_customer_identity_provider#

Returns the first instance from EnterpriseCustomerIdentityProvider relation.

enterprise_customer_identity_providers#

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.

enterprise_customer_users#

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.

enterprise_enrollment_template#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

genericenterprisecustomerpluginconfiguration_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.

get_country_display(*, field=<django_countries.fields.CountryField: country>)#
get_course_enrollment_url(course_key)#

Return enterprise landing page url for the given course.

Parameters:

course_key (str) – The course key for the course to be displayed.

Returns:

Enterprise landing page url.

Return type:

(str)

get_course_run_enrollment_url(course_run_key)#

Return enterprise landing page url for the given course.

Parameters:

course_run_key (str) – The course run id for the course to be displayed.

Returns:

Enterprise landing page url.

Return type:

(str)

Return DataSharingConsentTextOverrides associated with this instance.

get_default_language_display(*, field=<django.db.models.fields.CharField: default_language>)#
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_program_enrollment_url(program_uuid)#

Return enterprise landing page url for the given program.

Parameters:

program_uuid (str) – The program UUID.

Returns:

Enterprise program landing page url.

Return type:

(str)

get_tpa_hint(tpa_hint_param=None)#
Parameters:

tpa_hint_param – query param passed in the URL.

Returns:

tpa_hint to redirect

groups#

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.

property has_identity_providers#

Return True if there are any identity providers associated with this enterprise customer.

property has_multiple_idps#

Return True if there are multiple identity providers associated with this enterprise customer.

property has_single_idp#

Return True if there are exactly one identity provider associated with this enterprise customer.

hide_course_original_price#

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

hide_labor_market_data#

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

history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
property identity_provider#

Return the first identity provider id associated with this enterprise customer.

property identity_provider_ids#

Return the identity provider Ids associated with this enterprise customer.

property identity_providers#

Return the identity providers associated with this enterprise customer.

integratedchannelapirequestlogs_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.

invite_keys#

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.

modified#

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

moodleenterprisecustomerconfiguration_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.

name#

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

notify_enrolled_learners(catalog_api_user, course_id, users, admin_enrollment=False, activation_links=None)#

Notify learners about a course in which they’ve been enrolled.

Parameters:
  • catalog_api_user – The user for calling the Catalog API

  • course_id – The specific course the learners were enrolled in

  • users – An iterable of the users (or pending users) who were enrolled

  • admin_enrollment – Default False. Set to true if using bulk enrollment, for example. When true, we use the admin enrollment template instead.

  • activation_links (dict) – a dictionary map of unactivated license user emails to license activation links

objects = <django.db.models.manager.Manager object>#
pendingenterprisecustomeradminuser_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.

pendingenterprisecustomeruser_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.

replace_sensitive_sso_username#

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

reply_to#

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

reporting_configurations#

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.

Determine whether the enterprise customer has enabled the data sharing consent request.

property safe_branding_configuration#

Return the associated EnterpriseCustomerBrandingConfiguration object OR default branding config

This function should always be used to access the customer’s branding_configuration and prevent uncaught RelatedObjectDoesNotExist exceptions when accessed directly.

sapsuccessfactorsenterprisecustomerconfiguration_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.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

sender_alias#

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

property serialized#

Return a serialized version of this customer.

site#

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.

site_id#
slug#

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

sso_orchestration_records#

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.

property sync_learner_profile_data#

Return the sync_learner_profile data flag for the identity provider associated with this enterprise customer.

Returns False if enterprise customer does not have any identity provider.

system_wide_role_assignments#

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.

Sets enable_universal_link

If there is no change to be made, return.

When enable_universal_link changes to:
  • True: a new EnterpriseCustomerInviteKey is created, if total count is less than 100

  • False: all EnterpriseCustomerInviteKey are deactivated

Parameters:

enable_universal_link – new value

uuid#

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

xapilrsconfiguration#

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

class enterprise.models.EnterpriseCustomerBrandingConfiguration(*args, **kwargs)#

Bases: TimeStampedModel

Model that keeps track of enterprise branding configurations e.g. enterprise customer logo.

Fields:
  • enterprise_customer (ForeignKey[EnterpriseCustomer]) – enterprise customer

  • logo (ImageField) – enterprise customer image

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.

enterprise_customer#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_customer_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)#
id#

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

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

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>#
primary_color#

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

property safe_logo_url#

Returns an absolute URL for the branding configuration logo OR the platform logo absolute URL

secondary_color#

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

tertiary_color#

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

class enterprise.models.EnterpriseCustomerCatalog(*args, **kwargs)#

Bases: TimeStampedModel

Store catalog information from course discovery specifically for Enterprises.

We use this model to consolidate course catalog information, which includes information about catalogs, courses, programs, and possibly more in the future, as the course discovery service evolves.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

contains_courses(content_ids)#

Return True if this catalog contains the given courses else False.

The content_ids parameter should be a list containing course keys and/or course run ids.

contains_programs(program_uuids)#

Return true if this catalog contains the given programs.

content_filter#

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

content_filter_ids#

Return the list of any content IDs specified in the catalog’s content filter.

created#

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

enabled_course_modes#

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

enterprise_catalog_query#

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.

enterprise_catalog_query_id#
enterprise_customer#

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.

enterprise_customer_id#
enterprisecustomerreportingconfiguration_set#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

get_content_filter()#

Return content filter of the linked catalog query otherwise content filter of catalog itself.

get_course(course_key)#

Get all of the metadata for the given course.

Parameters:

course_key (str) – The course key which identifies the course.

Returns:

The course metadata.

Return type:

dict

get_course_and_course_run(course_run_id)#

Get course data and all of the metadata for the given course run.

Parameters:

course_run_id (str) – The course run key which identifies the course run.

Returns:

The course and course run metadata.

Return type:

tuple(course, course_run)

Raises:

ImproperlyConfigured – Missing or invalid catalog integration.

get_course_enrollment_url(course_key)#

Return enterprise course enrollment page url with the catalog information for the given course.

Parameters:

course_key (str) – The course key for the course to be displayed.

Returns:

Enterprise landing page url.

Return type:

(str)

get_course_run(course_run_id)#

Get all of the metadata for the given course run.

Parameters:

course_run_id (str) – The course run key which identifies the course run.

Returns:

The course run metadata.

Return type:

dict

get_course_run_enrollment_url(course_run_key)#

Return enterprise course enrollment page url with the catalog information for the given course.

Parameters:

course_run_key (str) – The course run id for the course to be displayed.

Returns:

Enterprise landing page url.

Return type:

(str)

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_paginated_content(query_parameters)#

Return paginated discovery service search results without expired course runs.

Parameters:

query_parameters (dict) – Additional query parameters to add to the search API call, e.g. page.

Returns:

The paginated discovery service search results.

Return type:

dict

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_program(program_uuid)#

Get all of the metadata for the given program.

Parameters:

program_uuid (str) – The program UUID which identifies the program.

Returns:

The program metadata.

Return type:

dict

get_program_enrollment_url(program_uuid)#

Return enterprise program enrollment page url with the catalog information for the given program.

Parameters:

program_uuid (str) – The program UUID.

Returns:

Enterprise program landing page url.

Return type:

(str)

history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
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>#
publish_audit_enrollment_urls#

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

save(*args, **kwargs)#

Saves this EnterpriseCatalogQuery.

Copies the content_filter of a related CatalogQuery into this instance’s content_filter if syncing is allowed.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

title#

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

uuid#

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

class enterprise.models.EnterpriseCustomerIdentityProvider(*args, **kwargs)#

Bases: TimeStampedModel

EnterpriseCustomerIdentityProvider is a One to Many relationship between Enterprise Customer and Identity Provider.

There should be a link between an enterprise customer and its Identity Provider. This relationship has following constraints:

  1. An enterprise customer may or may not have an identity provider.

  2. An enterprise customer can have more than one identity providers.

  3. Enterprise customer site should match with identity provider’s site. (i.e. same domain names)

Fields:
  • enterprise_customer (ForeignKey[EnterpriseCustomer]) – enterprise customer

  • provider_id (django.db.models.SlugField) – The provider_id string of the identity provider.

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.

default_provider#

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

enterprise_customer#

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.

enterprise_customer_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)#
id#

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

property identity_provider#

Associated identity provider instance.

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>#
provider_id#

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

property provider_name#

Readable name for the identity provider.

property sync_learner_profile_data#

Return bool indicating if data received from the identity provider should be synced to the edX profile.

class enterprise.models.EnterpriseCustomerInviteKey(*args, **kwargs)#

Bases: TimeStampedModel, SoftDeletableModel

Stores an invite key used to link a learner to an enterprise.

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.

enterprise_customer#

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.

enterprise_customer_id#
expiration_date#

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

classmethod from_db(db, field_names, values)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, 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_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
is_active#

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

is_removed#

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

property is_valid#

Returns whether the key is still valid (non-expired and usage limit has not been reached).

linked_enterprise_customer_users#

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.

modified#

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

save(*args, **kwargs)#

Saves this EnterpriseCustomerInviteKey.

Prevents is_active from being updated once it’s set to False.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

property usage_count#
usage_limit#

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

uuid#

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

class enterprise.models.EnterpriseCustomerManager(*args, **kwargs)#

Bases: Manager

Model manager for EnterpriseCustomer model.

Filters out inactive Enterprise Customers, otherwise works the same as default model manager.

get_queryset()#

Return a new QuerySet object. Filters out inactive Enterprise Customers.

class enterprise.models.EnterpriseCustomerReportingConfiguration(*args, **kwargs)#

Bases: TimeStampedModel

The Enterprise’s configuration for sending automated data reports securely via email to the Enterprise Admin.

ALLOWED_NON_COMPRESSION_DATA_TYPES = ('catalog',)#
DATA_TYPE_CATALOG = 'catalog'#
DATA_TYPE_CHOICES = (('progress_v3', 'progress_v3'), ('catalog', 'catalog'), ('engagement', 'engagement'), ('grade', 'grade'), ('completion', 'completion'), ('course_structure', 'course_structure'))#
DATA_TYPE_COMPLETION = 'completion'#
DATA_TYPE_COURSE_STRUCTURE = 'course_structure'#
DATA_TYPE_ENGAGEMENT = 'engagement'#
DATA_TYPE_GRADE = 'grade'#
DATA_TYPE_PROGRESS_V3 = 'progress_v3'#
DAYS_OF_WEEK = ((0, 'Monday'), (1, 'Tuesday'), (2, 'Wednesday'), (3, 'Thursday'), (4, 'Friday'), (5, 'Saturday'), (6, 'Sunday'))#
DELIVERY_METHOD_CHOICES = (('email', 'email'), ('sftp', 'sftp'))#
DELIVERY_METHOD_EMAIL = 'email'#
DELIVERY_METHOD_SFTP = 'sftp'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

FREQUENCY_CHOICES = (('daily', 'daily'), ('monthly', 'monthly'), ('weekly', 'weekly'))#
FREQUENCY_TYPE_DAILY = 'daily'#
FREQUENCY_TYPE_MONTHLY = 'monthly'#
FREQUENCY_TYPE_WEEKLY = 'weekly'#
MANUAL_REPORTS = ('grade', 'completion', 'course_structure')#
exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

REPORT_TYPE_CHOICES = (('csv', 'csv'), ('json', 'json'))#
REPORT_TYPE_CSV = 'csv'#
REPORT_TYPE_JSON = 'json'#
active#

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

clean()#

Override of clean method to perform additional validation on frequency, day_of_month/day_of week and compression.

created#

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

data_type#

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

day_of_month#

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

day_of_week#

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

decrypted_password#

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

decrypted_sftp_password#

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

delivery_method#

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

email#

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

enable_compression#

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

property encrypted_password#

Return encrypted password as a string.

The data is encrypted in the DB at rest, but is unencrypted in the app when retrieved through the decrypted_password field. This method will encrypt the password again before sending.

property encrypted_sftp_password#

Return encrypted SFTP password as a string.

The data is encrypted in the DB at rest, but is unencrypted in the app when retrieved through the decrypted_password field. This method will encrypt the password again before sending.

enterprise_customer#

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.

enterprise_customer_catalogs#

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

enterprise_customer_id#
frequency#

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

get_data_type_display(*, field=<django.db.models.fields.CharField: data_type>)#
get_day_of_week_display(*, field=<django.db.models.fields.SmallIntegerField: day_of_week>)#
get_delivery_method_display(*, field=<django.db.models.fields.CharField: delivery_method>)#
get_frequency_display(*, field=<django.db.models.fields.CharField: frequency>)#
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_report_type_display(*, field=<django.db.models.fields.CharField: report_type>)#
hour_of_day#

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

id#

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

include_date#

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>#
pgp_encryption_key#

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

report_type#

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

sftp_file_path#

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

sftp_hostname#

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

sftp_port#

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

sftp_username#

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

uuid#

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

classmethod validate_compression(enable_compression, data_type, delivery_method)#

Check enable_compression flag is set as expected

Parameters:
  • enable_compression (bool) – file compression flag

  • data_type (str) – report type

  • delivery_method (str) – delivery method for sending files

Returns:

Validation Error

Return type:

(dict)

validate_delivery_method(create_report, delivery_method)#

Check delivery_method is changed or not while updating report

Parameters:
  • create_report (str) – report uuid

  • delivery_method (str) – selected delivery method

Returns:

Validation Error

Return type:

(dict)

class enterprise.models.EnterpriseCustomerSsoConfiguration(*args, **kwargs)#

Bases: TimeStampedModel, SoftDeletableModel

Stores records of individual customer integrations with the SSO orchestration api.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

SAP_SUCCESS_FACTORS = 'sap_success_factors'#
active#

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

all_objects = <django.db.models.manager.Manager object>#
base_saml_config_fields = ('uuid', 'metadata_url', 'metadata_xml', 'entity_id', 'user_id_attribute', 'full_name_attribute', 'first_name_attribute', 'last_name_attribute', 'email_attribute', 'username_attribute', 'country_attribute', 'active', 'update_from_metadata')#
configured_at#

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

country_attribute#

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

created#

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

display_name#

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

email_attribute#

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

enterprise_customer#

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.

enterprise_customer_id#
entity_id#

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

errored_at#

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

fields_locked_while_configuring = ('metadata_url', 'metadata_xml', 'entity_id', 'user_id_attribute', 'full_name_attribute', 'last_name_attribute', 'email_attribute', 'username_attribute', 'country_attribute', 'active', 'update_from_metadata', 'odata_api_timeout_interval', 'odata_api_root_url', 'odata_company_id', 'sapsf_oauth_root_url', 'odata_api_request_timeout', 'sapsf_private_key', 'odata_client_id', 'oauth_user_id')#
first_name_attribute#

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

full_name_attribute#

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)#
history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
identity_provider#

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

is_pending_configuration()#

Returns True if the configuration has been submitted but not completed configuration.

is_removed#

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

last_name_attribute#

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

marked_authorized#

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

metadata_url#

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

metadata_xml#

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.

oauth_user_id#

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

odata_api_request_timeout#

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

odata_api_root_url#

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

odata_api_timeout_interval#

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

odata_client_id#

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

odata_company_id#

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

sap_config_fields = ('oauth_user_id', 'odata_api_request_timeout', 'odata_api_root_url', 'odata_api_timeout_interval', 'odata_client_id', 'odata_company_id', 'sapsf_oauth_root_url', 'sapsf_private_key')#
sapsf_oauth_root_url#

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

sapsf_private_key#

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

save(*args, **kwargs)#

Override the save method to ensure that the configuration is locked once submitted and not completed by the SSO orchestration api.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

submit_for_configuration(updating_existing_record=False)#

Submit the configuration to the SSO orchestration api.

submitted_at#

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

update_from_metadata#

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

user_id_attribute#

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

username_attribute#

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

uuid#

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

validated_at#

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

class enterprise.models.EnterpriseCustomerType(*args, **kwargs)#

Bases: TimeStampedModel

Enterprise Customer Types are used to differentiate Enterprise learners.

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.

enterprisecustomer_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.

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)#
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.

name#

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>#
class enterprise.models.EnterpriseCustomerUser(*args, **kwargs)#

Bases: TimeStampedModel

Model that keeps track of user - enterprise customer affinity.

Fields:
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

active#

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

adminnotificationread_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.

all_objects = <enterprise.models.EnterpriseCustomerUserManager object>#
create_order_for_enrollment(course_run_id, discount_percentage, mode, sales_force_id)#

Create an order on the Ecommerce side for tracking the course enrollment of a enterprise customer user.

created#

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

Return the DataSharingConsent records associated with this EnterpriseCustomerUser.

Returns:

The filtered DataSharingConsent QuerySet.

Return type:

QuerySet (DataSharingConsent)

enroll(course_run_id, mode, cohort=None, source_slug=None, discount_percentage=0.0, sales_force_id=None)#

Enroll a user into a course track, and register an enterprise course enrollment.

enterprise_customer#

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.

enterprise_customer_id#
enterprise_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.

enterprise_entitlements#

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.

classmethod get_active_enterprise_users(user_id, enterprise_customer_uuids=None)#

Return a queryset of all active enterprise users to which the given user is related. Or, if enterprise_customer_uuids is non-null, only the enterprise users related to the list of given enterprise_customer_uuids.

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_remote_id(idp_id=None)#

Retrieve the SSO provider’s identifier for this user from the LMS Third Party API. In absence of idp_id, returns id from default idp

Parameters:

idp_id (str) (optional) – If provided, idp resolution skipped and specified idp used to locate remote id.

Returns None if: * the user doesn’t exist, or * the associated EnterpriseCustomer has no identity_provider, or * the remote identity is not found.

history = <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.

classmethod inactivate_other_customers(user_id, enterprise_customer)#

Mark as inactive all the enterprise customers of given user except the given enterprise_customer.

invite_key#

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.

invite_key_id#
is_relinkable#

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

linked#

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

memberships#

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.

modified#

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

property name#

Return linked user’s name.

objects = <enterprise.models.EnterpriseCustomerUserManager object>#
save(*args, **kwargs)#

Override to handle creation of EnterpriseCustomerUser records.

This is needed because of soft deletion of EnterpriseCustomerUser records. This will handle all of get_or_create/update_or_create/create methods.

By default, when an EnterpriseCustomerUser record is created/updated with active=True, all other linked records for the user will be marked as active=False. To disable this side effect, update set should_inactivate_other_customers=False on an EnterpriseCustomerUser instance.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

should_inactivate_other_customers#

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

unenroll(course_run_id)#

Unenroll a user from a course track.

update_session(request)#

Update the session of a request for this learner.

property user#

Return User associated with this instance.

Return django.contrib.auth.models.User instance associated with this EnterpriseCustomerUser instance via email.

property user_email#

Return linked user email.

user_id#

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

property username#

Return linked user’s username.

class enterprise.models.EnterpriseCustomerUserManager(*args, **kwargs)#

Bases: Manager

Model manager for EnterpriseCustomerUser entity.

This class should contain methods that create, modify or query EnterpriseCustomerUser entities.

get(**kwargs)#

Overridden get method to return the first element in case of learner with multiple enterprises.

Raises EnterpriseCustomerUser.DoesNotExist if no records are found.

Return link by email and enterprise_customer

get_queryset()#

Return linked or unlinked learners based on how the manager is created.

Link user email to Enterprise Customer.

If django.contrib.auth.models.User instance with specified email does not exist, PendingEnterpriseCustomerUser instance is created instead.

Unlink user email from Enterprise Customer.

If django.contrib.auth.models.User instance with specified email does not exist, PendingEnterpriseCustomerUser instance is deleted instead.

Raises EnterpriseCustomerUser.DoesNotExist if instance of django.contrib.auth.models.User with specified email exists and corresponding EnterpriseCustomerUser instance does not.

Raises PendingEnterpriseCustomerUser.DoesNotExist exception if instance of django.contrib.auth.models.User with specified email exists and corresponding PendingEnterpriseCustomerUser instance does not.

class enterprise.models.EnterpriseEnrollmentSource(*args, **kwargs)#

Bases: TimeStampedModel

Define a Name and Source for all Enterprise Enrollment Sources.

API = 'enterprise_api'#
CUSTOMER_ADMIN = 'customer_admin'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

ENROLLMENT_TASK = 'enrollment_task'#
ENROLLMENT_URL = 'enrollment_url'#
MANAGEMENT_COMMAND = 'management_command'#
MANUAL = 'manual'#
exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

OFFER_REDEMPTION = 'offer_redemption'#
created#

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

enterprisecourseenrollment_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.

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)#
classmethod get_source(source_slug)#

Retrieve the source based on the Slug provided.

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.

name#

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>#
pendingenrollment_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.

slug#

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

class enterprise.models.EnterpriseFeatureRole(*args, **kwargs)#

Bases: UserRole

Enterprise-specific feature role definitions.

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.

description#

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

enterprisefeatureuserroleassignment_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.

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)#
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.

name#

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>#
class enterprise.models.EnterpriseFeatureUserRoleAssignment(*args, **kwargs)#

Bases: UserRoleAssignment

Model to map users to an EnterpriseFeatureRole.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

applies_to_all_contexts#

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

created#

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

property enterprise_customer_uuids#

Get the enterprise customer uuids linked to the user.

get_context()#

Returns a non-empty list of enterprise customer uuid strings to which self.user is linked, or None if the user is not linked to any EnterpriseCustomer.

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)#
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#

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.

role_class#

alias of EnterpriseFeatureRole

role_id#
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#
class enterprise.models.EnterpriseFulfillmentSource(*args, **kwargs)#

Bases: TimeStampedModel

Base class for enterprise subsidy fulfillments

class Meta#

Bases: object

abstract = False#
created#

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

classmethod enrollments_for_user(enterprise_customer_user)#

Returns a QuerySet of subsidy based enrollment records for a particular user, along with their associated (hydrated) user, enterprise enrollments, and customer object.

enterprise_course_enrollment#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_course_enrollment_id#
enterprise_course_entitlement#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_course_entitlement_id#
property enterprise_customer_user#
fulfillment_type#

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

get_fulfillment_type_display(*, field=<django.db.models.fields.CharField: fulfillment_type>)#
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)#
is_revoked#

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.

reactivate(**kwargs)#

Idempotently reactivates this enterprise fulfillment source.

revoke()#

Marks this object as revoked and marks the associated EnterpriseCourseEnrollment as “saved for later”. This object and the associated EnterpriseCourseEnrollment are both saved.

TODO: revoke entitlements as well?

save(*args, **kwargs)#

Overriding the save method in order to make sure that modified field is updated even if it is not given as a parameter to the update field argument.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

uuid#

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

class enterprise.models.EnterpriseGroup(*args, **kwargs)#

Bases: TimeStampedModel, SoftDeletableModel

Enterprise Group model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

applies_to_all_contexts#

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

created#

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

enterprise_customer#

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.

enterprise_customer_id#
get_all_learners(user_query=None, sort_by=None, desc_order=False, fetch_removed=False, pending_users_only=False)#

Returns all users associated with the group, whether the group specifies the entire org else all associated membership records.

Params:

q (optional): filter the returned members list by user email and name with a provided sub-string sort_by (optional): specify how the list of returned members should be ordered. Supported sorting values are memberDetails, memberStatus, and recentAction. Ordering can be reversed by supplying a - at the beginning of the sorting value ie -memberStatus.

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)#
history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
is_removed#

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

members#

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.

modified#

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

name#

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

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

uuid#

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

class enterprise.models.EnterpriseGroupMembership(*args, **kwargs)#

Bases: TimeStampedModel, SoftDeletableModel

Enterprise Group Membership model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

activated_at#

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

clean(*args, **kwargs)#

Ensure that records added via Django Admin have matching customer records between learner and group.

created#

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

enterprise_customer_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.

enterprise_customer_user_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_status_display(*, field=<django.db.models.fields.CharField: status>)#
group#

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.

group_id#
history = <django.db.models.manager.HistoryManagerFromHistoricalQuerySet object>#
is_removed#

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

member_email#

Return the email associated with the member

membership_user#

Return the user record associated with the membership, defaulting to enterprise_customer_user and falling back on obj.pending_enterprise_customer_user

modified#

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

pending_enterprise_customer_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.

pending_enterprise_customer_user_id#
recent_action#

Return the timestamp of the most recent action relating to the membership

removed_at#

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

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

Make sure you know what you’re doing before you use 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.

uuid#

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

class enterprise.models.EnterpriseRoleAssignmentContextMixin#

Bases: object

Mixin for RoleAssignment models related to enterprises.

DEPRECATED: Not removing since it’s referenced in a migration (0001_squashed_0092_auto_20200312_1650).

class enterprise.models.HistoricalEnrollmentNotificationEmailTemplate(id, created, modified, plaintext_template, html_template, subject_line, template_type, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

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.

enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
get_template_type_display(*, field=<django.db.models.fields.CharField: template_type>)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
html_template#

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

id#

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

property instance#
instance_type#

alias of EnrollmentNotificationEmailTemplate

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

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

property prev_record#

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

subject_line#

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

template_type#

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

class enterprise.models.HistoricalEnterpriseCourseEnrollment(id, created, modified, course_id, saved_for_later, unenrolled, unenrolled_at, enterprise_customer_user, source, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

course_id#

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

created#

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

enterprise_customer_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.

enterprise_customer_user_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of EnterpriseCourseEnrollment

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

saved_for_later#

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

source#

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.

source_id#
unenrolled#

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

unenrolled_at#

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

class enterprise.models.HistoricalEnterpriseCourseEntitlement(id, created, modified, uuid, course_uuid, enterprise_customer_user, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

course_uuid#

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

created#

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

enterprise_customer_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.

enterprise_customer_user_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of EnterpriseCourseEntitlement

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

uuid#

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

class enterprise.models.HistoricalEnterpriseCustomer(created, modified, uuid, name, slug, auth_org_id, active, country, hide_course_original_price, enable_data_sharing_consent, enforce_data_sharing_consent, enable_audit_enrollment, enable_audit_data_reporting, replace_sensitive_sso_username, enable_autocohorting, enable_portal_code_management_screen, enable_portal_reporting_config_screen, enable_portal_subscription_management_screen, enable_portal_saml_configuration_screen, enable_universal_link, enable_browse_and_request, enable_learner_portal, enable_learner_portal_offers, enable_portal_learner_credit_management_screen, hide_labor_market_data, enable_integrated_customer_learner_portal_search, enable_career_engagement_network_on_learner_portal, enable_pathways, enable_programs, enable_academies, enable_one_academy, enable_analytics_screen, enable_portal_lms_configurations_screen, enable_slug_login, enable_executive_education_2U_fulfillment, enable_demo_data_for_analytics_and_lpr, contact_email, default_contract_discount, default_language, sender_alias, reply_to, enable_generation_of_api_credentials, career_engagement_network_message, site, customer_type, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

active#

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

auth_org_id#

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

career_engagement_network_message#

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

contact_email#

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

country#

A descriptor for country fields on a model instance. Returns a Country when accessed so you can do things like:

>>> from people import Person
>>> person = Person.object.get(name='Chris')

>>> person.country.name
'New Zealand'

>>> person.country.flag
'/static/flags/nz.gif'
created#

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

customer_type#

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.

customer_type_id#
default_contract_discount#

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

default_language#

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

enable_academies#

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

enable_analytics_screen#

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

enable_audit_data_reporting#

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

enable_audit_enrollment#

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

enable_autocohorting#

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

enable_browse_and_request#

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

enable_career_engagement_network_on_learner_portal#

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

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

enable_demo_data_for_analytics_and_lpr#

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

enable_executive_education_2U_fulfillment#

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

enable_generation_of_api_credentials#

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

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

enable_learner_portal#

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

enable_learner_portal_offers#

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

enable_one_academy#

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

enable_pathways#

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

enable_portal_code_management_screen#

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

enable_portal_learner_credit_management_screen#

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

enable_portal_lms_configurations_screen#

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

enable_portal_reporting_config_screen#

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

enable_portal_saml_configuration_screen#

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

enable_portal_subscription_management_screen#

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

enable_programs#

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

enable_slug_login#

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

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

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

get_country_display(*, field=<django_countries.fields.CountryField: country>)#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_default_language_display(*, field=<django.db.models.fields.CharField: default_language>)#
get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
hide_course_original_price#

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

hide_labor_market_data#

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

history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
property instance#
instance_type#

alias of EnterpriseCustomer

modified#

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

name#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

replace_sensitive_sso_username#

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

reply_to#

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

revert_url()#

URL for this change in the default admin site.

sender_alias#

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

site#

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.

site_id#
slug#

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

uuid#

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

class enterprise.models.HistoricalEnterpriseCustomerCatalog(created, modified, uuid, title, content_filter, enabled_course_modes, publish_audit_enrollment_urls, enterprise_customer, enterprise_catalog_query, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

content_filter#

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

created#

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

enabled_course_modes#

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

enterprise_catalog_query#

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.

enterprise_catalog_query_id#
enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
property instance#
instance_type#

alias of EnterpriseCustomerCatalog

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

publish_audit_enrollment_urls#

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

revert_url()#

URL for this change in the default admin site.

title#

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

uuid#

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

class enterprise.models.HistoricalEnterpriseCustomerInviteKey(created, modified, is_removed, uuid, usage_limit, expiration_date, is_active, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

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.

enterprise_customer#

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.

enterprise_customer_id#
expiration_date#

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

static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_expiration_date(*, field=<django.db.models.fields.DateTimeField: expiration_date>, is_next=False, **kwargs)#
get_previous_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
property instance#
instance_type#

alias of EnterpriseCustomerInviteKey

is_active#

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

is_removed#

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.

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

usage_limit#

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

uuid#

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

class enterprise.models.HistoricalEnterpriseCustomerSsoConfiguration(created, modified, is_removed, display_name, uuid, active, identity_provider, metadata_url, metadata_xml, entity_id, update_from_metadata, user_id_attribute, full_name_attribute, first_name_attribute, last_name_attribute, email_attribute, username_attribute, country_attribute, submitted_at, configured_at, validated_at, errored_at, marked_authorized, odata_api_timeout_interval, odata_api_root_url, odata_company_id, sapsf_oauth_root_url, odata_api_request_timeout, sapsf_private_key, odata_client_id, oauth_user_id, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

active#

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

configured_at#

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

country_attribute#

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

created#

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

display_name#

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

email_attribute#

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

enterprise_customer#

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.

enterprise_customer_id#
entity_id#

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

errored_at#

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

first_name_attribute#

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

full_name_attribute#

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

static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
identity_provider#

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

property instance#
instance_type#

alias of EnterpriseCustomerSsoConfiguration

is_removed#

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

last_name_attribute#

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

marked_authorized#

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

metadata_url#

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

metadata_xml#

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.

property next_record#

Get the next history record for the instance. None if last.

oauth_user_id#

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>#
odata_api_request_timeout#

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

odata_api_root_url#

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

odata_api_timeout_interval#

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

odata_client_id#

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

odata_company_id#

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

property prev_record#

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

sapsf_oauth_root_url#

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

sapsf_private_key#

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

submitted_at#

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

update_from_metadata#

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

user_id_attribute#

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

username_attribute#

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

uuid#

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

validated_at#

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

class enterprise.models.HistoricalEnterpriseCustomerUser(id, created, modified, user_id, active, linked, is_relinkable, should_inactivate_other_customers, enterprise_customer, invite_key, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

active#

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

created#

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

enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of EnterpriseCustomerUser

invite_key#

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.

invite_key_id#
is_relinkable#

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

linked#

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.

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

should_inactivate_other_customers#

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

user_id#

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

class enterprise.models.HistoricalEnterpriseGroup(created, modified, is_removed, uuid, name, applies_to_all_contexts, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

applies_to_all_contexts#

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

created#

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

enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
property instance#
instance_type#

alias of EnterpriseGroup

is_removed#

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.

name#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

uuid#

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

class enterprise.models.HistoricalEnterpriseGroupMembership(created, modified, is_removed, uuid, activated_at, status, removed_at, group, enterprise_customer_user, pending_enterprise_customer_user, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

activated_at#

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

created#

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

enterprise_customer_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.

enterprise_customer_user_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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>)#
group#

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.

group_id#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
property instance#
instance_type#

alias of EnterpriseGroupMembership

is_removed#

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.

property next_record#

Get the next history record for the instance. None if last.

objects = <django.db.models.manager.Manager object>#
pending_enterprise_customer_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.

pending_enterprise_customer_user_id#
property prev_record#

Get the previous history record for the instance. None if first.

removed_at#

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

revert_url()#

URL for this change in the default admin site.

status#

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

uuid#

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

class enterprise.models.HistoricalLearnerCreditEnterpriseCourseEnrollment(id, created, modified, uuid, fulfillment_type, is_revoked, transaction_id, enterprise_course_entitlement, enterprise_course_enrollment, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

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.

enterprise_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.

enterprise_course_enrollment_id#
enterprise_course_entitlement#

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.

enterprise_course_entitlement_id#
fulfillment_type#

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

static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_fulfillment_type_display(*, field=<django.db.models.fields.CharField: fulfillment_type>)#
get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of LearnerCreditEnterpriseCourseEnrollment

is_revoked#

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.

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

transaction_id#

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

uuid#

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

class enterprise.models.HistoricalLicensedEnterpriseCourseEnrollment(id, created, modified, uuid, fulfillment_type, is_revoked, license_uuid, enterprise_course_entitlement, enterprise_course_enrollment, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

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.

enterprise_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.

enterprise_course_enrollment_id#
enterprise_course_entitlement#

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.

enterprise_course_entitlement_id#
fulfillment_type#

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

static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_fulfillment_type_display(*, field=<django.db.models.fields.CharField: fulfillment_type>)#
get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of LicensedEnterpriseCourseEnrollment

is_revoked#

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

license_uuid#

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.

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

uuid#

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

class enterprise.models.HistoricalPendingEnrollment(id, created, modified, course_id, course_mode, cohort_name, discount_percentage, sales_force_id, license_uuid, user, source, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

cohort_name#

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

course_id#

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

course_mode#

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

created#

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

discount_percentage#

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

static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of PendingEnrollment

license_uuid#

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.

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

sales_force_id#

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

source#

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.

source_id#
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#
class enterprise.models.HistoricalPendingEnterpriseCustomerAdminUser(id, created, modified, user_email, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

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.

enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of PendingEnterpriseCustomerAdminUser

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

user_email#

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

class enterprise.models.HistoricalPendingEnterpriseCustomerUser(id, created, modified, user_email, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

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.

enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of PendingEnterpriseCustomerUser

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

user_email#

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

class enterprise.models.HistoricalSystemWideEnterpriseUserRoleAssignment(id, created, modified, applies_to_all_contexts, user, role, enterprise_customer, history_id, history_date, history_change_reason, history_type, history_user)#

Bases: HistoricalChanges, Model

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

applies_to_all_contexts#

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

created#

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

enterprise_customer#

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.

enterprise_customer_id#
static get_default_history_user(instance)#

Returns the user specified by get_user method for manually creating historical objects

get_history_type_display(*, field=<django.db.models.fields.CharField: history_type>)#
get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)#
get_next_by_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, 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_history_date(*, field=<django.db.models.fields.DateTimeField: history_date>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)#
history_change_reason#

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

history_date#

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

history_id#

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

history_object#
history_type#

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

history_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.

history_user_id#
id#

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

property instance#
instance_type#

alias of SystemWideEnterpriseUserRoleAssignment

modified#

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

property next_record#

Get the next history record for the instance. None if last.

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

Get the previous history record for the instance. None if first.

revert_url()#

URL for this change in the default admin site.

role#

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.

role_id#
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#
class enterprise.models.LearnerCreditEnterpriseCourseEnrollment(*args, **kwargs)#

Bases: EnterpriseFulfillmentSource

An Enterprise Course Enrollment that is enrolled via a transaction ID.

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.

enterprise_course_enrollment#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_course_enrollment_id#
enterprise_course_entitlement#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_course_entitlement_id#
fulfillment_type#

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

get_fulfillment_type_display(*, field=<django.db.models.fields.CharField: fulfillment_type>)#
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)#
history = <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.

is_revoked#

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>#
reactivate(transaction_id=None, **kwargs)#

Idmpotently reactivates this LearnerCreditEnterpriseCourseEnrollment.

Parameters:

transaction_id (str) – New ledgered transaction UUID to associate with this learner credit fulfillment.

transaction_id#

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

uuid#

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

class enterprise.models.LicensedEnterpriseCourseEnrollment(*args, **kwargs)#

Bases: EnterpriseFulfillmentSource

An Enterprise Course Enrollment that is enrolled via a license.

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.

enterprise_course_enrollment#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_course_enrollment_id#
enterprise_course_entitlement#

Accessor to the related object on the forward side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

enterprise_course_entitlement_id#
fulfillment_type#

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

get_fulfillment_type_display(*, field=<django.db.models.fields.CharField: fulfillment_type>)#
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)#
history = <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.

is_revoked#

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

license_uuid#

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>#
uuid#

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

class enterprise.models.PendingEnrollment(*args, **kwargs)#

Bases: TimeStampedModel

Track future enrollments for PendingEnterpriseCustomerUser.

Store a course ID, an intended enrollment mode, and a link to a PendingEnterpriseCustomerUser; when the PendingEnterpriseCustomerUser is converted to a full EnterpriseCustomerUser, API calls will be made to enroll the newly-created user in whatever courses have been added.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

cohort_name#

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

course_id#

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

course_mode#

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

created#

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

discount_percentage#

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)#
history = <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.

license_uuid#

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>#
sales_force_id#

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

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

source#

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.

source_id#
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#
class enterprise.models.PendingEnterpriseCustomerAdminUser(*args, **kwargs)#

Bases: TimeStampedModel

Model for pending enterprise admin users.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

admin_registration_url#

Returns a URL to be used by a pending enterprise admin user to register their account.

created#

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

enterprise_customer#

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.

enterprise_customer_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)#
history = <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>#
save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

user_email#

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

class enterprise.models.PendingEnterpriseCustomerUser(*args, **kwargs)#

Bases: TimeStampedModel

Model that stores “future members” of enterprise customer.

Fields:
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.

enterprise_customer#

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.

enterprise_customer_id#
fulfill_pending_course_enrollments(enterprise_customer_user)#

Enrolls a newly created EnterpriseCustomerUser in any courses attached to their PendingEnterpriseCustomerUser record.

Parameters:

enterprise_customer_user – a EnterpriseCustomerUser instance

fulfill_pending_group_memberships(enterprise_customer_user)#

Updates any membership records associated with a new created enterprise customer user object.

Parameters:

enterprise_customer_user – a EnterpriseCustomerUser instance

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)#
history = <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.

Link a PendingEnterpriseCustomerUser to the appropriate EnterpriseCustomer by creating or updating an EnterpriseCustomerUser record.

Parameters:
  • is_user_created – a boolean whether the User instance was created or updated

  • user – a User instance

Returns: an EnterpriseCustomerUser instance

memberships#

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.

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>#
pendingenrollment_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.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

user_email#

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

class enterprise.models.SystemWideEnterpriseRole(*args, **kwargs)#

Bases: UserRole

System wide user role definitions specific to Enterprise.

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.

description#

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)#
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.

name#

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>#
system_wide_role_assignments#

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.

class enterprise.models.SystemWideEnterpriseUserRoleAssignment(*args, **kwargs)#

Bases: UserRoleAssignment

Model to map users to a SystemWideEnterpriseRole.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

applies_to_all_contexts#

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

created#

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

enterprise_customer#

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.

enterprise_customer_id#
classmethod get_assignments(user, role_names=None)#

Return an iterator of (rolename, [enterprise customer uuids]) for the given user (and maybe role_names).

Differs from super().get_assignments(…) in that it yields (role name, customer uuid list) pairs such that the first item in the customer uuid list for each role corresponds to the currently active EnterpriseCustomerUser for the user.

The resulting generated pairs are sorted by role name, and within role_name, by (active, customer uuid). For example:

(‘enterprise_admin’, [‘active-enterprise-uuid’, ‘inactive-enterprise-uuid’, ‘other-inactive-enterprise-uuid’]) (‘enterprise_learner’, [‘active-enterprise-uuid’, ‘inactive-enterprise-uuid’]), (‘enterprise_openedx_operator’, [‘*’])

get_context()#

Return a non-empty list of contexts for which self.user is assigned self.role.

classmethod get_distinct_assignments_by_role_name(user, role_names=None)#

Returns a mapping of role names to sets of enterprise customer uuids for which the user is assigned that role.

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)#
has_access_to_all_contexts()#

Returns true if the role for this assignment is ENTERPRISE_OPERATOR_ROLE, or if applies_to_all_contexts is true; returns false otherwise.

history = <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>#
role#

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.

role_id#
save(*args, **kwargs)#

Overriding the save method in order to make sure that modified field is updated even if it is not given as a parameter to the update field argument.

save_without_historical_record(*args, **kwargs)#

Save model without saving a historical record

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

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#
enterprise.models.get_default_customer_type()#

Get default enterprise customer type id to use when creating a new EnterpriseCustomer model.

enterprise.models.get_default_site()#

Get default site id to use when creating a new EnterpriseCustomer model. The default value depending on what environment the person is in. In production, it should be ‘courses.edx.org’. In stage it should be ‘courses.stage.edx.org’.

enterprise.roles_api module#

Python API for doing CRUD operations on roles and user role assignments.

enterprise.roles_api.admin_role()#

Return the enterprise admin role.

enterprise.roles_api.assign_admin_role(user, enterprise_customer=None, applies_to_all_contexts=False)#

Assigns the given user the enterprise_admin role in the given customer.

enterprise.roles_api.assign_learner_role(user, enterprise_customer=None, applies_to_all_contexts=False)#

Assigns the given user the enterprise_learner role in the given customer.

enterprise.roles_api.catalog_admin_role()#

Returns the enterprise catalog admin role.

enterprise.roles_api.delete_admin_role_assignment(user, enterprise_customer=None)#

Deletes the admin role assignment for the given user in the given enterprise customer. If enterprise_customer is null, will delete every admin role assignment for this user.

enterprise.roles_api.delete_learner_role_assignment(user, enterprise_customer=None)#

Deletes the learner role assignment for the given user in the given enterprise customer. If enterprise_customer is null, will delete every learner role assignment for this user.

enterprise.roles_api.delete_role_assignment(user, role, enterprise_customer=None)#

Deletes the given role assignment for the given user in the given enterprise customer. If enterprise_customer is null, will delete every role assignment for this user.

enterprise.roles_api.get_or_create_system_wide_role(role_name)#

Gets or creates the SystemWideEnterpriseRole with the given name. Caches the result for 60 minutes in the Django cache. Returns the role object.

enterprise.roles_api.learner_role()#

Returns the enterprise learner role.

enterprise.roles_api.openedx_operator_role()#

Returns the enterprise openedx operator role.

enterprise.roles_api.roles_by_name()#

Returns a mapping of system wide roles by name.

enterprise.rules module#

Rules needed to restrict access to the enterprise data api.

enterprise.signals module#

Django signal handlers.

enterprise.signals.assign_or_delete_enterprise_learner_role(sender, instance, **kwargs)#

Assign or delete enterprise_learner role for EnterpriseCustomerUser when created or updated.

The enterprise_learner role is assigned when a new EnterpriseCustomerUser record is initially created and removed when a EnterpriseCustomerUser record is updated and unlinked (i.e., soft delete - see ENT-2538).

enterprise.signals.create_enterprise_enrollment_receiver(sender, instance, **kwargs)#

Watches for post_save signal for creates on the CourseEnrollment table.

Spin off an async task to generate an EnterpriseCourseEnrollment if appropriate.

enterprise.signals.create_pending_enterprise_admin_user(sender, instance, **kwargs)#

Creates a PendingEnterpriseCustomerUser when a PendingEnterpriseCustomerAdminUser is created.

enterprise.signals.default_content_filter(sender, instance, **kwargs)#

Set default value for EnterpriseCustomerCatalog.content_filter if not already set.

enterprise.signals.delete_enterprise_admin_role_assignment(sender, instance, **kwargs)#

Delete the associated enterprise admin role assignment record when deleting an EnterpriseCustomerUser record.

enterprise.signals.delete_enterprise_catalog_data(sender, instance, **kwargs)#

Send deletions of Enterprise Catalogs to the Enterprise Catalog Service.

enterprise.signals.delete_enterprise_learner_role_assignment(sender, instance, **kwargs)#

Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.

enterprise.signals.delete_pending_enterprise_admin_user(sender, instance, **kwargs)#

Deletes a PendingEnterpriseCustomerUser when its associated PendingEnterpriseCustomerAdminUser is removed.

enterprise.signals.enterprise_unenrollment_receiver(sender, **kwargs)#

Mark the EnterpriseCourseEnrollment object as unenrolled when a user unenrolls from a course.

enterprise.signals.generate_default_orchestration_record_display_name(sender, instance, **kwargs)#

Ensure that the display_name field is populated with a default value if it is not provided while creating.

enterprise.signals.handle_user_post_save(sender, **kwargs)#

Handle User model changes. Context: This signal runs any time a user logs in, including b2c users.

Steps:

  1. Check for existing PendingEnterpriseCustomerUser(s) for user’s email. If one or more exists, create an EnterpriseCustomerUser record for each which will ensure the user has the “enterprise_learner” role.

  2. When we get a new EnterpriseCustomerUser record (or an existing record if one existed), check if the PendingEnterpriseCustomerUser has any pending course enrollments. If so, enroll the user in these courses.

  3. Delete the PendingEnterpriseCustomerUser record as its no longer needed.

  4. Using the newly created EnterpriseCustomerUser (or an existing record if one existed), check if there is a PendingEnterpriseCustomerAdminUser. If so, ensure the user has the “enterprise_admin” role.

enterprise.signals.save_logo_file(sender, instance, **kwargs)#

Now that the object is instantiated and instance.id exists, save the image at correct path and re-save the model.

enterprise.signals.skip_saving_logo_file(sender, instance, **kwargs)#

To avoid saving the logo image at an incorrect path, skip saving it.

enterprise.signals.update_enterprise_catalog_data(sender, instance, **kwargs)#

Send data changes to Enterprise Catalogs to the Enterprise Catalog Service.

Additionally sends a request to update the catalog’s metadata from discovery, and index any relevant content for Algolia.

enterprise.signals.update_enterprise_catalog_query(sender, instance, **kwargs)#

Sync data changes from Enterprise Catalog Query to the Enterprise Customer Catalog.

enterprise.signals.update_lang_pref_of_all_learners(sender, instance, **kwargs)#

Update the language preference of all the learners belonging to the enterprise customer. Set the language preference to the value enterprise customer has used as the default_language.

enterprise.signals.update_learner_language_preference(sender, instance, created, **kwargs)#

Update the language preference of the learner. Set the language preference to the value enterprise customer has used as the default_language.

enterprise.tasks module#

Django tasks.

enterprise.tasks.enterprise_course_enrollment_model()#

Returns the EnterpriseCourseEnrollment class. This function is needed to avoid circular ref issues when model classes call tasks in this module.

enterprise.tasks.enterprise_customer_user_model()#

Returns the EnterpriseCustomerUser class. This function is needed to avoid circular ref issues when model classes call tasks in this module.

enterprise.tasks.enterprise_enrollment_source_model()#

Returns the EnterpriseEnrollmentSource class. This function is needed to avoid circular ref issues when model classes call tasks in this module.

enterprise.tasks.enterprise_group_membership_model()#

Returns the EnterpriseGroupMembership class. This function is needed to avoid circular ref issues when model classes call tasks in this module.

enterprise.tasks.pending_enterprise_customer_user_model()#

Returns the PendingEnterpriseCustomerUser class. This function is needed to avoid circular ref issues when model classes call tasks in this module.

enterprise.toggles module#

Waffle toggles for enterprise features within the LMS.

enterprise.toggles.enterprise_features()#

Returns a dict of enterprise Waffle-based feature flags.

enterprise.toggles.enterprise_groups_v1()#

Returns whether the enterprise groups feature flag is enabled.

enterprise.toggles.feature_prequery_search_suggestions()#

Returns whether the prequery search suggestion feature flag is enabled.

enterprise.toggles.top_down_assignment_real_time_lcm()#

Returns whether top-down assignment and real time LCM feature flag is enabled.

enterprise.tpa_pipeline module#

Module provides elements to be used in third-party auth pipeline.

enterprise.tpa_pipeline.get_default_idp_user_social_auth(enterprise_customer, user=None, user_idp_id=None)#

Return social auth entry of user for given enterprise default IDP.

Parameters:
  • user (User) – user object

  • enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.

  • user_idp_id (str) – User id of user in third party LMS

enterprise.tpa_pipeline.get_enterprise_customer_for_running_pipeline(request, pipeline)#

Get the EnterpriseCustomer associated with a running pipeline.

enterprise.tpa_pipeline.get_enterprise_customer_for_sso(sso_provider_id)#

Get the EnterpriseCustomer object tied to an identity provider.

enterprise.tpa_pipeline.get_sso_provider(request, pipeline)#

Helper method to retrieve the sso provider ID from either a user’s SSO login request

enterprise.tpa_pipeline.get_user_from_social_auth(tpa_providers, user_id, enterprise_customer)#

Find the LMS user from the LMS model UserSocialAuth.

Parameters:
  • tpa_providers (third_party_auth.provider) – list of third party auth provider objects

  • user_id (str) – User id of user in third party LMS

  • enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.

enterprise.tpa_pipeline.get_user_social_auth(user, enterprise_customer)#

Return social auth entry of user for given enterprise.

Parameters:
  • user (User) – user object

  • enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.

enterprise.tpa_pipeline.handle_enterprise_logistration(backend, user, **kwargs)#

Perform the linking of user in the process of logging to the Enterprise Customer.

Parameters:
  • backend – The class handling the SSO interaction (SAML, OAuth, etc)

  • user – The user object in the process of being logged in with

  • **kwargs – Any remaining pipeline variables

enterprise.tpa_pipeline.handle_redirect_after_social_auth_login(backend, user)#

Change the redirect url if user has more than 1 EnterpriseCustomer associations.

Parameters:
  • backend (User) – social auth backend object

  • user (User) – user object

enterprise.tpa_pipeline.select_enterprise_page_as_redirect_url(strategy)#

Change the redirect url for the user to enterprise selection page.

enterprise.tpa_pipeline.validate_provider_config(enterprise_customer, sso_provider_id)#

Helper method to ensure that a customer’s provider config is validated

enterprise.urls module#

URLs for enterprise.

enterprise.utils module#

Utility functions for enterprise app.

exception enterprise.utils.CourseCatalogApiError#

Bases: Exception

Exception to raise when we we received data from Course Catalog but it contained an error.

exception enterprise.utils.CourseEnrollmentDowngradeError#

Bases: Exception

Exception to raise when an enrollment attempts to enroll the user in an unpaid mode when they are in a paid mode.

exception enterprise.utils.CourseEnrollmentPermissionError#

Bases: Exception

Exception to raise when an enterprise attempts to use enrollment features it’s not configured to use.

exception enterprise.utils.NotConnectedToOpenEdX(*args, **kwargs)#

Bases: Exception

Exception to raise when not connected to OpenEdX.

In general, this exception shouldn’t be raised, because this package is designed to be installed directly inside an existing OpenEdX platform.

class enterprise.utils.ValidationMessages#

Bases: object

Namespace class for validation messages.

BOTH_COURSE_FIELDS_SPECIFIED = 'Either "CSV bulk upload" or a singular course ID may be used for manual enrollments, but not both together.'#
BOTH_FIELDS_SPECIFIED = 'Either "Email or Username" or "CSV bulk upload" must be specified, but both were.'#
COURSE_MODE_INVALID_FOR_COURSE = 'Enrollment track {course_mode} is not available for course {course_id}.'#
COURSE_NOT_EXIST_IN_CATALOG = "Course ID {course_id} doesn't exist in Enterprise Customer's Catalog"#
COURSE_WITHOUT_COURSE_MODE = 'Select a course enrollment track for the given course(s).'#
INVALID_CHANNEL_WORKER = 'Enterprise channel worker user with the username "{channel_worker_username}" was not found.'#
INVALID_COURSE_ID = 'Could not retrieve details for the course ID {course_id}. Specify a valid ID.'#
INVALID_DISCOUNT = 'Discount percentage should be from 0 to 100.'#
INVALID_EMAIL = '{argument} does not appear to be a valid email address.'#
INVALID_EMAIL_OR_USERNAME = '{argument} does not appear to be a valid email address or known username'#
INVALID_ENCODING = "Unable to parse CSV file. Please make sure it is a CSV 'utf-8' encoded file."#
MISSING_EXPECTED_COLUMNS = 'Expected a CSV file with [{expected_columns}] columns, but found [{actual_columns}] columns instead.'#
MISSING_REASON = 'Reason field is required but was not filled.'#
NO_FIELDS_SPECIFIED = 'Either "Email or Username" or "CSV bulk upload" must be specified, but neither were.'#
USER_ALREADY_REGISTERED = 'User with email address {email} is already registered with Enterprise Customer {ec_name}'#
USER_NOT_EXIST = "User with email address {email} doesn't exist."#
USER_NOT_LINKED = 'User is not linked with Enterprise Customer'#
enterprise.utils.batch(iterable, batch_size=1)#

Break up an iterable into equal-sized batches.

Parameters:
  • iterable (e.g. list) – an iterable to batch

  • batch_size (int) – the size of each batch. Defaults to 1.

Returns:

iterates through each batch of an iterable

Return type:

generator

enterprise.utils.camelCase(string)#

Convert a string to camelCase.

enterprise.utils.clean_html_for_template_rendering(text)#

Given html text that will be rendered as a variable in a template, strip out characters that impact rendering.

Parameters:

text (str) – The text to clean.

Returns:

The cleaned text.

Return type:

(str)

enterprise.utils.convert_to_snake(string)#

Helper method to convert strings to snake case.

enterprise.utils.customer_admin_enroll_user(enterprise_customer, user, course_mode, course_id, enrollment_source=None)#

For use with bulk enrollment, or any use case of admin enrolling a user

Enroll a single user in a course using a particular course mode, indicating it’s a customer_admin enrolling a user (such as bulk enrollment)

Parameters:
  • enterprise_customer – The EnterpriseCustomer model object which is sponsoring the enrollment

  • user – The user model object who needs to be enrolled in the course

  • course_mode – The string representation of the mode with which the enrollment should be created

  • course_id – An opaque course_id to enroll in

Returns:

Whether or not enrollment succeeded for the course specified

Return type:

succeeded (Boolean)

enterprise.utils.customer_admin_enroll_user_with_status(enterprise_customer, user, course_mode, course_id, enrollment_source=None, license_uuid=None, transaction_id=None, force_enrollment=False)#

For use with bulk enrollment, or any use case of admin enrolling a user

Enroll a single user in a course using a particular course mode, indicating it’s a customer_admin enrolling a user (such as bulk enrollment). Return a status based on whether the enrollment existed before attempting to enroll.

TODO: The enroll_user function above, used by Django admin, for example, should also be rewired to use this new ability, but for now it still uses enrollment client.

Parameters:
  • enterprise_customer – The EnterpriseCustomer model object which is sponsoring the enrollment

  • user – The user model object who needs to be enrolled in the course

  • course_mode – The string representation of the mode with which the enrollment should be created

  • course_id – An opaque course_id to enroll in

  • enrollment_source – Source of enrollment, used for tracking enrollments

  • license_uuid – UUID of associated license with the enrollment, used to create a mapping between licenses and enrollments

  • transaction_id – UUID of associated ledgered transaction if this enrollment is subsidized via learner credit 2.

Returns:

Whether or not the enrollment succeeded for the course specified created (Boolean): Whether or not the enrollment existed prior to calling method

Return type:

succeeded (Boolean)

Delete the DSC records from the DB for given learner, course and customer, also its cache.

enterprise.utils.discovery_query_url(content_filter, html_format=True)#

Return discovery url for preview.

enterprise.utils.enroll_subsidy_users_in_courses(enterprise_customer, subsidy_users_info, discount=100.0)#

Takes a list of licensed learner data and enrolls each learner in the requested courses.

Parameters:
  • enterprise_customer – The EnterpriseCustomer (object) which is sponsoring the enrollment

  • subsidy_users_info (list of dict) –

    Each element contains information necessary to create a enterprise enrollment from a subsidy for a specific learner in a specified course run. Required fields:

    • ’user_id’ OR ‘email’: Either unique identifier describing the user to enroll.

    • ’course_run_key’: The course to enroll into.

    • ’course_mode’: The course mode.

    • ’license_uuid’ OR ‘transaction_id’: ID of either accepted form of subsidy.

    • ’force_enrollment’ (bool, optional): Enroll user even enrollment deadline is expired (default False).

    Example:

    licensed_users_info: [
        {
            'email': 'newuser@test.com',
            'course_run_key': 'course-v1:edX+DemoX+Demo_Course',
            'course_mode': 'verified',
            'license_uuid': '5b77bdbade7b4fcb838f8111b68e18ae'
        },
        {
            'email': 'newuser2@test.com',
            'course_run_key': 'course-v2:edX+FunX+Fun_Course',
            'course_mode': 'unpaid-executive-education',
            'transaction_id': '84kdbdbade7b4fcb838f8asjke8e18ae',
        },
        {
            'user_id': 1234,
            'course_run_key': 'course-v1:edX+SadX+Sad_Course',
            'course_mode': 'unpaid-executive-education',
            'transaction_id': '3a5312d722564db0a16e3d81f53a3718',
        },
    ]
    

  • discount – (int) the discount offered to the learner for their enrollment. Subscription based enrollments default to 100

Expected Return Values:

Results: {
    successes:
        [{ 'user_id': <lms_user_id>, 'email': <email>, 'course_run_key': <key>, 'user': <user object> } ... ],
    pending:
        [{ 'user_id': <lms_user_id>, 'email': <email>, 'course_run_key': <key>, 'user': <user object> } ... ],
    failures:
        [{ 'user_id': <lms_user_id>, 'email': <email>, 'course_run_key': <key> } ... ]
}
enterprise.utils.enroll_user(enterprise_customer, user, course_mode, *course_ids, **kwargs)#

Enroll a single user in any number of courses using a particular course mode.

Parameters:
  • enterprise_customer – The EnterpriseCustomer model object which is sponsoring the enrollment

  • user – The user model object who needs to be enrolled in the course

  • course_mode – The string representation of the mode with which the enrollment should be created

  • *course_ids – An iterable containing any number of course IDs to eventually enroll the user in.

  • kwargs – Should contain enrollment_client if it’s already been instantiated and should be passed in.

Returns:

Whether or not enrollment succeeded for all courses specified

Return type:

Boolean

enterprise.utils.enroll_users_in_course(enterprise_customer, course_id, course_mode, emails, enrollment_requester=None, enrollment_reason=None, discount=0.0, sales_force_id=None)#

Enroll existing users in a course, and create a pending enrollment for nonexisting users.

Parameters:
  • enterprise_customer – The EnterpriseCustomer which is sponsoring the enrollment

  • course_id (str) – The unique identifier of the course in which we’re enrolling

  • course_mode (str) – The mode with which we’re enrolling in the course

  • emails – An iterable of email addresses which need to be enrolled

  • enrollment_requester (User) – Admin user who is requesting the enrollment.

  • enrollment_reason (str) – A reason for enrollment.

  • discount (Decimal) – Percentage discount for enrollment.

  • sales_force_id (str) – Salesforce opportunity id.

Returns:

A list of users who were successfully enrolled in the course.

pending: A list of PendingEnterpriseCustomerUsers who were successfully

linked and had pending enrollments created for them in the database.

failures: A list of users who could not be enrolled in the course.

Return type:

successes

enterprise.utils.enterprise_course_enrollment_model()#

Returns the EnterpriseCourseEnrollment class.

enterprise.utils.enterprise_customer_invite_key_model()#

Returns the EnterpriseCustomerInviteKey class.

enterprise.utils.enterprise_customer_model()#

Returns the EnterpriseCustomer class.

enterprise.utils.enterprise_customer_user_model()#

Returns the EnterpriseCustomerUser class.

enterprise.utils.enterprise_enrollment_source_model()#

Returns the EnterpriseEnrollmentSource class.

enterprise.utils.filter_audit_course_modes(enterprise_customer, course_modes)#

Filter audit course modes out if the enterprise customer has not enabled the ‘Enable audit enrollment’ flag.

Parameters:
  • enterprise_customer – The EnterpriseCustomer that the enrollment was created using.

  • course_modes – iterable with dictionaries containing a required ‘mode’ key

enterprise.utils.find_enroll_email_template(enterprise_customer, template_type)#

Find email template from the template database represented by EnrollmentNotificationEmailTemplate model.

Parameters:
  • enterprise_customer (-) – the customer model

  • template_type (-) – type of template to fetch, must be one of: enterprise.utils.SELF_ENROLL_EMAIL_TEMPLATE_TYPE, or enterprise.utils.ADMIN_ENROLL_EMAIL_TEMPLATE_TYPE

Returns:

Customer specific template if found. Default template for the given type if found. None if neither default template, nor per customer template found.

enterprise.utils.format_price(price, currency='$')#

Format the price to have the appropriate currency and digits..

Parameters:
  • price – The price amount.

  • currency – The currency for the price.

Returns:

A formatted price string, i.e. ‘$10’, ‘$10.52’.

enterprise.utils.get_active_course_runs(course, users_all_enrolled_courses)#

Return active course runs (user is enrolled in) of the given course.

This function will return the course_runs of ‘course’ which have active enrollment by looking into ‘users_all_enrolled_courses’

enterprise.utils.get_advertised_course_run(course)#

Find the advertised course run for a given course :param course: course dict :type course: dict

Returns:

a course_run or None

Return type:

dict

enterprise.utils.get_advertised_or_closest_course_run(content_metadata_item)#

Returns advertised course run of a course. If the advertised run does not exist, it looks for the closest run.

enterprise.utils.get_all_field_names(model, excluded=None)#

Return all fields’ names from a model. Filter out the field names present in excluded.

According to Django documentation, get_all_field_names should become some monstrosity with chained iterable ternary nested in a list comprehension. For now, a simpler version of iterating over fields and getting their names work, but we might have to switch to full version in future.

enterprise.utils.get_best_mode_from_course_key(course_key)#

Helper method to retrieve a list of enrollments for a given course and select the one most applicable to enroll an enterprise learner in.

enterprise.utils.get_cache_key(**kwargs)#

Wrapper method on edx_django_utils get_cache_key utility.

enterprise.utils.get_catalog_admin_url(catalog_id)#

Get url to catalog details admin page.

Parameters:

catalog_id (int) – Catalog id for which to return catalog details url.

Returns:

URL pointing to catalog details admin page for the give catalog id.

Example

>>> get_catalog_admin_url_template(2)
"http://localhost:18381/admin/catalogs/catalog/2/change/"
enterprise.utils.get_catalog_admin_url_template(mode='change')#

Get template of catalog admin url.

URL template will contain a placeholder ‘{catalog_id}’ for catalog id. :param mode e.g. change/add.:

Returns:

A string containing template for catalog url.

Example

>>> get_catalog_admin_url_template('change')
"http://localhost:18381/admin/catalogs/catalog/{catalog_id}/change/"
enterprise.utils.get_closest_course_run(course_runs)#

Return course run with start date closest to now.

enterprise.utils.get_configuration_value(val_name, default=None, **kwargs)#

Get a configuration value, or fall back to default if it doesn’t exist.

Also takes a type argument to guide which particular upstream method to use when trying to retrieve a value. Current types include:

  • url to specifically get a URL.

enterprise.utils.get_configuration_value_for_site(site, key, default=None)#

Get the site configuration value for a key, unless a site configuration does not exist for that site.

Useful for testing when no Site Configuration exists in edx-enterprise or if a site in LMS doesn’t have a configuration tied to it.

Parameters:
  • site – A Site model object

  • key – The name of the value to retrieve

  • default – The default response if there’s no key in site config or settings

Returns:

The value located at that key in the site configuration or settings file.

enterprise.utils.get_content_metadata_item_id(content_metadata_item)#

Return the unique identifier given a content metadata item dictionary.

enterprise.utils.get_course_run_duration_info(course_run)#

Return course run’s duration(str) info.

enterprise.utils.get_course_run_start(course_run, default=None)#

Return the given course run’s start date as a datetime.

enterprise.utils.get_course_track_selection_url(course_run, query_parameters)#

Return track selection url for the given course.

Parameters:
  • course_run (dict) – A dictionary containing course run metadata.

  • query_parameters (dict) – A dictionary containing query parameters to be added to course selection url.

Raises:

(KeyError) – Raised when course run dict does not have ‘key’ key.

Returns:

Course track selection url.

Return type:

(str)

enterprise.utils.get_create_ent_enrollment(course_id, enterprise_customer_user, enterprise_enrollment_source, license_uuid=None)#

Get or Create the Enterprise Course Enrollment.

If license_uuid present, will also create a LicensedEnterpriseCourseEnrollment record.

enterprise.utils.get_current_course_run(course, users_active_course_runs)#

Return the current course run on the following conditions:

  • If user has active course runs (already enrolled) then return course run with closest start date

Otherwise it will check the following logic:

  • Course run is enrollable (see is_course_run_enrollable)

  • Course run has a verified seat and the upgrade deadline has not expired.

  • If no enrollable/upgradeable course runs, then select all the course runs.

  • After filtering the course runs checks whether the filtered course run is about to close or not if yes then return the next course run or the current one.

enterprise.utils.get_default_catalog_content_filter()#

Return default enterprise customer catalog content filter.

enterprise.utils.get_default_invite_key_expiration_date()#

Returns the default expiration date for an invite key.

The default expiration date is 365 days from the current date.

enterprise.utils.get_duration_of_course_or_courserun(content_metadata_item)#

Returns duration start, end dates given a piece of content_metadata item If course item, extracts start, end dates of closest course run based on current timestamp

Returns:

in days or 0 start: start field of closest course run item, or None end: end field of closest course run item, or None

Return type:

duration

enterprise.utils.get_ecommerce_worker_user()#

Return the user object of ecommerce worker user.

enterprise.utils.get_enterprise_customer(uuid)#

Get the EnterpriseCustomer instance associated with uuid.

Parameters:

uuid – The universally unique ID of the enterprise customer.

Returns:

The EnterpriseCustomer instance, or None if it doesn’t exist.

enterprise.utils.get_enterprise_customer_by_invite_key_or_404(invite_key_uuid)#

Given an EnterpriseCustomerInviteKey UUID, return the corresponding EnterpriseCustomer or raise a 404.

Parameters:

invite_key_uuid (str) – The UUID identifying an EnterpriseCustomerInviteKey.

Returns:

The EnterpriseCustomer given the EnterpriseCustomerInviteKey UUID.

Return type:

(EnterpriseCustomer)

enterprise.utils.get_enterprise_customer_by_slug_or_404(slug)#

Given an EnterpriseCustomer slug, return the corresponding EnterpriseCustomer or raise a 404.

Parameters:

slug (str) – The unique slug (a string) identifying the customer.

Returns:

The EnterpriseCustomer given the slug.

Return type:

(EnterpriseCustomer)

enterprise.utils.get_enterprise_customer_for_user(auth_user)#

Return first found enterprise customer instance for given user.

Some users are associated with an enterprise customer via EnterpriseCustomerUser model,
  1. if given user is associated with any enterprise customer, return first enterprise customer.

  2. otherwise return None.

Parameters:

auth_user (contrib.auth.User) – Django User

Returns:

enterprise customer associated with the current user.

Return type:

(EnterpriseCustomer)

enterprise.utils.get_enterprise_customer_or_404(enterprise_uuid)#

Given an EnterpriseCustomer UUID, return the corresponding EnterpriseCustomer or raise a 404.

Parameters:

enterprise_uuid (str) – The UUID (in string form) of the EnterpriseCustomer to fetch.

Returns:

The EnterpriseCustomer given the UUID.

Return type:

(EnterpriseCustomer)

enterprise.utils.get_enterprise_customer_user(user_id, enterprise_uuid)#

Return the object for EnterpriseCustomerUser.

Parameters:
  • user_id (str) – user identifier

  • enterprise_uuid (UUID) – Universally unique identifier for the enterprise customer.

Returns:

enterprise customer user record

Return type:

(EnterpriseCustomerUser)

enterprise.utils.get_enterprise_utm_context(enterprise_customer)#

Get the UTM context for the enterprise.

enterprise.utils.get_enterprise_uuids_for_user_and_course(auth_user, course_run_id, is_customer_active=None)#

Get the EnterpriseCustomer UUID(s) associated with a user and a course id``.

Some users are associated with an enterprise customer via EnterpriseCustomerUser model,
  1. if given user is enrolled in a specific course via an enterprise customer enrollment, return related enterprise customers as a list.

  2. otherwise return empty list.

Parameters:
  • auth_user (contrib.auth.User) – Django User

  • course_run_id (str) – Course Run to lookup an enrollment against.

  • active – (boolean or None): Filter flag for returning active, inactive, or all uuids

Returns:

enterprise customer uuids associated with the current user and course run or None

Return type:

(list of str)

enterprise.utils.get_enterprise_worker_user()#

Return the user object of enterprise worker user.

enterprise.utils.get_identity_provider(provider_id)#

Get Identity Provider with given id.

Returns:

Instance of ProviderConfig or None.

enterprise.utils.get_idiff_list(list_a, list_b)#

Returns a list containing lower case difference of list_b and list_a after case insensitive comparison.

Parameters:
  • list_a – list of strings

  • list_b – list of string

Returns:

List of unique lower case strings computed by subtracting list_b from list_a.

enterprise.utils.get_idp_choices()#

Get a list of identity providers choices for enterprise customer.

Returns:

A list of choices of all identity providers, None if it can not get any available identity provider.

enterprise.utils.get_integrated_channel_choices()#

Helper method to return channel code for each integrated channel.

enterprise.utils.get_integrations_for_customers(customer_uuid)#

Helper method to return channel code for each enterprise customer with active integrations.

Parameters:

customer_uuid (UUI) – uuid of an enterprise customer

Returns:

a list of integration channel codes.

Return type:

list

enterprise.utils.get_language_code(language)#

Return IETF language tag of given language name.

  • if language is not found in the language map then en-US is returned.

Parameters:

language (str) – string language name

Returns: a language tag (two-letter language code - two letter country code if applicable)

enterprise.utils.get_last_course_run_end_date(course_runs)#

Returns the end date of the course run that falls at the end.

enterprise.utils.get_learner_portal_url(enterprise_customer)#

Learner portal url for enterprise_customer

enterprise.utils.get_md5_hash(content)#

Get the MD5 hash digest of the given content.

Parameters:

content (str) – Content in string format for calculating MD5 hash digest.

Returns:

MD5 hash digest.

Return type:

(str)

enterprise.utils.get_notification_subject_line(course_name, template_configuration=None)#

Get a subject line for a notification email.

The method is designed to fail in a “smart” way; if we can’t render a database-backed subject line template, then we’ll fall back to a template saved in the Django settings; if we can’t render _that_ one, then we’ll fall through to a friendly string written into the code.

One example of a failure case in which we want to fall back to a stock template would be if a site admin entered a subject line string that contained a template tag that wasn’t available, causing a KeyError to be raised.

Parameters:
  • course_name (str) – Course name to be rendered into the string

  • template_configuration – A database-backed object with a stored subject line template

enterprise.utils.get_oauth2authentication_class()#

Return oauth2 authentication class to authenticate REST APIs with Bearer token.

enterprise.utils.get_platform_logo_url()#

Return an absolute URL of the platform logo using the branding api.

enterprise.utils.get_program_type_description(program_type)#

Get the pre-set description associated with this program type.

Parameters:

program_type – The type of the program. Should be one of:

  • “MicroMasters Certificate”

  • “Professional Certificate”

  • “XSeries Certificate”

Returns:

The description associated with the program type. If none exists, then the empty string.

enterprise.utils.get_request_value(request, key, default=None)#

Get the value in the request, either through query parameters or posted data, from a key.

Parameters:
  • request – The request from which the value should be gotten.

  • key – The key to use to get the desired value.

  • default – The backup value to use in case the input key cannot help us get the value.

Returns:

The value we’re looking for.

enterprise.utils.get_social_auth_from_idp(idp, user=None, user_idp_id=None)#

Return social auth entry of user for given enterprise IDP.

idp (EnterpriseCustomerIdentityProvider): EnterpriseCustomerIdentityProvider Object user (User): User Object user_idp_id (str): User id of user in third party LMS

enterprise.utils.get_sso_orchestrator_api_base_url()#

Return the SSO orchestrator api base url settings value.

enterprise.utils.get_sso_orchestrator_basic_auth_password()#

Return the SSO orchestrator auth password settings value.

enterprise.utils.get_sso_orchestrator_basic_auth_username()#

Return the SSO orchestrator auth username settings value.

enterprise.utils.get_sso_orchestrator_configure_edx_oauth_path()#

Return the SSO orchestrator configure-edx-oauth endpoint path, or None if it is not defined.

enterprise.utils.get_sso_orchestrator_configure_path()#

Return the SSO orchestrator configure path settings value.

enterprise.utils.get_user_valid_idp(user, enterprise_customer)#

Return the default idp if it has user social auth record else it will return any idp with valid user social auth record

user (User): user object enterprise_customer (EnterpriseCustomer): EnterpriseCustomer object

enterprise.utils.get_users_by_email(emails)#

Accept a list of emails, and separate them into users that exist on OpenEdX and users who don’t.

Parameters:

emails – An iterable of email addresses to split between existing and nonexisting

Returns:

Queryset of users who exist in the OpenEdX platform and who were in the list of email addresses unregistered_emails: List of unique emails which were in the original list, but do not yet exist as users

Return type:

users

enterprise.utils.has_course_run_available_for_enrollment(course_runs)#

Iterates over all course runs to check if there any course run that is available for enrollment.

Argument:

course_runs: list of course runs

Returns:

True if found else false

enterprise.utils.is_course_run_about_to_end(current_course_run)#

Return False if end - now > course run’s weeks to complete otherwise True.

enterprise.utils.is_course_run_active(course_run)#

Checks whether a course run is active. That is, whether the course run is published, enrollable, and marketable. :param course_run: The metadata about a course run. :type course_run: dict

Returns:

True if course run is “active”

Return type:

bool

enterprise.utils.is_course_run_available_for_enrollment(course_run)#

Check if a course run is available for enrollment.

enterprise.utils.is_course_run_enrollable(course_run)#

Return true if the course run is enrollable, false otherwise.

We look for the following criteria:

  1. end date is greater than a reasonably-defined enrollment window, or undefined.

    A reasonably-defined enrollment window is 1 day before course run end date.

  2. enrollment_start is less than now, or undefined.

  3. enrollment_end is greater than now, or undefined.

enterprise.utils.is_course_run_published(course_run)#

Return True if the course run’s status value is “published”.

enterprise.utils.is_course_run_upgradeable(course_run)#

Return true if the course run has a verified seat with an unexpired upgrade deadline, false otherwise.

enterprise.utils.is_pending_user(user)#

Returns true if pending_user attributes are detected

enterprise.utils.is_user_enrolled(user, course_id, course_mode, enrollment_client=None)#

Query the enrollment API and determine if a learner is enrolled in a given course run track.

Parameters:
  • user – The user whose enrollment needs to be checked

  • course_mode – The mode with which the enrollment should be checked

  • course_id – course id of the course where enrollment should be checked.

  • enrollment_client – An optional EnrollmentAPIClient if it’s already been instantiated and should be passed in.

Returns:

Whether or not enrollment exists

Return type:

Boolean

enterprise.utils.is_valid_url(url)#

Return where the specified URL is a valid absolute url.

enterprise.utils.licensed_enterprise_course_enrollment_model()#

returns the LicensedEnterpriseCourseEnrollment class.

enterprise.utils.localized_utcnow()#

Helper function to return localized utcnow().

enterprise.utils.logo_path(instance, filename)#

Returns the enterprise customer logo image path.

Parameters:
Returns:

path of image file e.g. enterprise/branding/<enterprise_uuid>/logo_<uuid>.<ext>.lower()

Return type:

path

enterprise.utils.parse_datetime_handle_invalid(datetime_value)#

Return the parsed version of a datetime string. If the string is invalid, return None.

enterprise.utils.parse_lms_api_datetime(datetime_string, datetime_format='%Y-%m-%dT%H:%M:%SZ')#

Parse a received datetime into a timezone-aware, Python datetime object.

Parameters:
  • datetime_string – A string to be parsed.

  • datetime_format – A datetime format string to be used for parsing

enterprise.utils.send_email_notification_message(user, enrolled_in, dashboard_url, enterprise_customer_uuid, email_connection=None, admin_enrollment=False)#

Send an email notifying a user about their enrollment in a course.

Parameters:
  • user – a dict with either of the following forms: - 1: { ‘first_name’: name, ‘username’: user_name, ‘email’: email } (similar to a User object) - 2: { ‘user_email’ : user_email } (similar to a PendingEnterpriseCustomerUser object)

  • enrolled_in (dict) –

    The dictionary contains details of the enrollable object (either course or program) that the user enrolled in. This MUST contain a name key, and MAY contain the other following keys:

    - url: A human-friendly link to the enrollable's home page
    
    - type: Either `course` or `program` at present
    
    - branding: A special name for what the enrollable "is"; for example,
        "MicroMasters" would be the branding for a "MicroMasters Program"
    
    - start: A datetime object indicating when the enrollable will be available.
    

  • dashboard_url – link to enterprise customer’s unique homepage for user

  • enterprise_customer_uuid – The EnterpriseCustomer uuid that the enrollment was created using.

  • email_connection – An existing Django email connection that can be used without creating a new connection for each individual message

  • admin_enrollment – If true, uses admin enrollment template instead of default ones.

enterprise.utils.serialize_notification_content(enterprise_customer, course_details, course_id, users, admin_enrollment=False, activation_links=None)#

Prepare serializable contents to send emails with (if using tasks to send emails)

Parameters:
  • enterprise_customer (enterprise.models.EnterpriseCustomer) –

  • course_details (dict) – With at least ‘title’, ‘start’ and ‘course’ keys (usually obtained via CourseCatalogApiClient)

  • course_id (str) –

  • users (list) – list of users to enroll (each user should be a User or PendingEnterpriseCustomerUser)

  • activation_links (dict) – a dictionary map of unactivated license user emails to license activation links

Returns: A list of dictionary objects that are of the form:

{
  "user": user
  "enrolled_in": {
      'name': course_name,
      'url': destination_url,
      'type': 'course',
      'start': course_start,
  },
  "dashboard_url": dashboard_url,
  "enterprise_customer_uuid": self.uuid,
  "admin_enrollment": admin_enrollment,
}
where user is one of
  • 1: { ‘first_name’: name, ‘username’: user_name, ‘email’: email } (dict of User object)

  • 2: { ‘user_email’ : user_email } (dict of PendingEnterpriseCustomerUser object)

enterprise.utils.strip_html_tags(text, allowed_tags=None)#

Strip all tags from a string except those tags provided in allowed_tags parameter.

Parameters:
  • text (str) – string to strip html tags from

  • allowed_tags (list) – allowed list of html tags

Returns: a string without html tags

enterprise.utils.subsidized_enterprise_course_enrollment_model()#

returns the LearnerCreditEnterpriseCourseEnrollment class.

enterprise.utils.track_enrollment(pathway, user_id, course_run_id, url_path=None)#

Emit a track event for enterprise course enrollment.

enterprise.utils.track_enterprise_user_linked(user_id, enterprise_customer_key, enterprise_customer_id, created_new_ent_user)#

Emit a track event when user is linked to an enterprise

enterprise.utils.track_event(user_id, event_name, properties)#

Emit a track event to segment (and forwarded to GA) for some parts of the Enterprise workflows.

enterprise.utils.traverse_pagination(response, client, api_url)#

Traverse a paginated API response.

Extracts and concatenates “results” (list of dict) returned by DRF-powered APIs.

Parameters:
  • response (Dict) – Current response dict from service API;

  • client (requests.Session) – either the OAuthAPIClient (from edx_rest_api_client) or requests.Session object;

  • api_url (str) – API endpoint URL to call.

Returns:

list of dict.

enterprise.utils.truncate_string(string, max_length=16000000)#

Truncate a string to the specified max length. If max length is not specified, it will be set to MAX_ALLOWED_TEXT_LENGTH.

Returns:

(truncated_string, was_truncated)

Return type:

(tuple)

enterprise.utils.ungettext_min_max(singular, plural, range_text, min_val, max_val)#

Return grammatically correct, translated text based off of a minimum and maximum value.

Example

min = 1, max = 1, singular = ‘{} hour required for this course’, plural = ‘{} hours required for this course’ output = ‘1 hour required for this course’

min = 2, max = 2, singular = ‘{} hour required for this course’, plural = ‘{} hours required for this course’ output = ‘2 hours required for this course’

min = 2, max = 4, range_text = ‘{}-{} hours required for this course’ output = ‘2-4 hours required for this course’

min = None, max = 2, plural = ‘{} hours required for this course’ output = ‘2 hours required for this course’

Expects range_text to already have a translation function called on it.

Returns:

None if both of the input values are None. singular formatted if both are equal or one of the inputs, but not both, are None, and the value is 1. plural formatted if both are equal or one of its inputs, but not both, are None, and the value is > 1. range_text formatted if min != max and both are valid values.

enterprise.utils.unset_enterprise_learner_language(enterprise_customer_user)#

Unset the language preference of the given enterprise learners.

Parameters:

enterprise_customer_user (EnterpriseCustomerUser) – Instance of the enterprise customer user.

enterprise.utils.unset_language_of_all_enterprise_learners(enterprise_customer_uuid)#

Unset the language preference of all the learners belonging to the given enterprise customer.

Parameters:

enterprise_customer_uuid (UUI) – uuid of an enterprise customer

enterprise.utils.update_query_parameters(url, query_parameters)#

Return url with updated query parameters.

Parameters:
  • url (str) – Original url whose query parameters need to be updated.

  • query_parameters (dict) – A dictionary containing query parameters to be added to course selection url.

Returns:

slug identifier for the identity provider that can be used for identity verification of

users associated the enterprise customer of the given user.

Return type:

(slug)

enterprise.utils.validate_course_exists_for_enterprise(enterprise_customer, course_id, **kwargs)#

Validates that a specified course id exists within the LMS and within the enterprise_customer’s catalog(s).

Parameters:
  • enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.

  • course_id (string) – The unique identifier of a course.

  • kwargs – Should contain enrollment_client if it’s already been instantiated and is passed in.

Validate email to be linked to Enterprise Customer.

Performs two checks:
  • Checks that email is valid

  • Checks that it is not already linked to the provided Enterprise Customer

Parameters:
  • email (str) – user email to link

  • enterprise_customer (EnterpriseCustomer) – the enterprise customer to link the email to

  • raw_email (str) – raw value as it was passed by user - used in error message.

  • message_template (str) – Validation error template string.

  • raise_exception (bool) – whether to raise an exception when an email is invalidated

Raises:

ValidationError – if email is invalid or already linked to Enterprise Customer.

Returns:

Whether or not there is an existing record with the same email address.

Return type:

bool

enterprise.validators module#

Database models field validators.

enterprise.validators.get_app_config()#

:return Application configuration.

enterprise.validators.validate_content_filter_fields(content_filter)#

Validate particular fields (if present) passed in through content_filter are certain types.

enterprise.validators.validate_hex_color(value)#

Validate value is suitable for a color hex value.

enterprise.validators.validate_image_extension(value)#

Validate that a particular image extension.

enterprise.validators.validate_image_size(image)#

Validate that a particular image size.

enterprise.validators.validate_pgp_key(pgp_key)#

Validate that given PGP key is valid.

Raises:

(ValidationError) – Raised if given pgp_key is not valid.

enterprise.views module#

User-facing views for the Enterprise app.

class enterprise.views.CourseEnrollmentView(**kwargs)#

Bases: NonAtomicView

Enterprise landing page view.

This view will display the course mode selection with related enterprise information.

PACING_FORMAT = {'instructor_paced': 'Instructor-Paced', 'self_paced': 'Self-Paced'}#
get(request, enterprise_uuid, course_id)#

Show course track selection page for the enterprise.

Based on enterprise_uuid in URL, the view will decide which enterprise customer’s course enrollment page is to use.

Unauthenticated learners will be redirected to enterprise-linked SSO.

A 404 will be raised if any of the following conditions are met:
  • No enterprise customer uuid kwarg enterprise_uuid in request.

  • No enterprise customer found against the enterprise customer

    uuid enterprise_uuid in the request kwargs.

  • No course is found in database against the provided course_id.

get_available_course_modes(request, course_run_id, enterprise_catalog)#

Return the available course modes for the course run.

The provided EnterpriseCustomerCatalog is used to filter and order the course modes returned using the EnterpriseCustomerCatalog’s field “enabled_course_modes”.

get_base_details(request, enterprise_uuid, course_run_id)#

Retrieve fundamental details used by both POST and GET versions of this view.

Specifically, take an EnterpriseCustomer UUID and a course run ID, and transform those into an actual EnterpriseCustomer, a set of details about the course, and a list of the available course modes for that course run.

get_enterprise_course_enrollment_page(request, enterprise_customer, course, course_run, course_modes, enterprise_course_enrollment, data_sharing_consent)#

Render enterprise-specific course track selection page.

post(request, enterprise_uuid, course_id)#

Process a submitted track selection form for the enterprise.

set_final_prices(modes, request)#

Set the final discounted price on each premium mode.

class enterprise.views.EnterpriseLoginView(**kwargs)#

Bases: FormView

Allow an enterprise learner to login by enterprise customer’s slug login.

form_class#

alias of EnterpriseLoginForm

form_invalid(form)#

If the form is invalid then return the errors.

form_valid(form)#

If the form is valid, redirect to the third party auth login page.

get_context_data(**kwargs)#

Return the context data needed to render the view.

template_name = 'enterprise/enterprise_customer_login_page.html'#
class enterprise.views.EnterpriseProxyLoginView(**kwargs)#

Bases: View

Allows an enterprise learner to login via existing flow from the learner portal.

get(request)#

Redirects a learner through login with their enterprise’s third party auth if it uses tpa.

class enterprise.views.EnterpriseSelectionView(**kwargs)#

Bases: FormView

Allow an enterprise learner to activate one of learner’s linked enterprises.

dispatch(request, *args, **kwargs)#
form_class#

alias of EnterpriseSelectionForm

form_invalid(form)#

If the form is invalid then return the errors.

form_valid(form)#

If the form is valid, activate the selected enterprise.

get_context_data(**kwargs)#

Return the context data needed to render the view.

get_initial()#

Return the initial data to use for forms on this view.

template_name = 'enterprise/enterprise_customer_select_form.html'#
class enterprise.views.FailedEnrollmentReason(enrollment_client_error, failure_reason_message)#

Bases: tuple

enrollment_client_error#

Alias for field number 0

failure_reason_message#

Alias for field number 1

class enterprise.views.GrantDataSharingPermissions(**kwargs)#

Bases: View

Provide a form and form handler for data sharing consent.

View handles the case in which we get to the “verify consent” step, but consent hasn’t yet been provided - this view contains a GET view that provides a form for consent to be provided, and a POST view that consumes said form.

course_or_program_exist(course_id, program_uuid)#

Return whether the input course or program exist.

static create_enterprise_course_enrollment(request, enterprise_customer, course_id, license_uuid=None)#

Create EnterpriseCustomerUser and EnterpriseCourseEnrollment record if not already exists.

get(request)#

Render a form to collect user input about data sharing consent.

get_context_from_db(consent_page, platform_name, item, context)#

Make set of variables(populated from db) that will be used in data sharing consent page.

get_course_or_program_context(enterprise_customer, course_id=None, program_uuid=None)#

Return a dict having course or program specific keys for data sharing consent page.

get_default_context(enterprise_customer, platform_name)#

Get the set of variables that will populate the template by default.

get_page_language_context_data(course_id, enterprise_customer, success_url, failure_url, license_uuid, request, platform_name)#

Return a dict of data for the language on the page.

is_course_run_id(course_id)#

Returns True if the course_id is in the correct format of a course_run_id, false otherwise.

Parameters:

course_id (str) – The course_key or course run id

Returns:

True or False

Return type:

(Boolean)

post(request)#

Process the above form.

preview_mode = False#
class enterprise.views.HandleConsentEnrollment(**kwargs)#

Bases: View

Handle enterprise course enrollment at providing data sharing consent.

View handles the case for enterprise course enrollment after successful consent.

get(request, enterprise_uuid, course_id)#

Handle the enrollment of enterprise learner in the provided course.

Based on enterprise_uuid in URL, the view will decide which enterprise customer’s course enrollment record should be created.

Depending on the value of query parameter course_mode then learner will be either redirected to LMS dashboard for audit modes or redirected to ecommerce basket flow for payment of premium modes.

class enterprise.views.NonAtomicView(**kwargs)#

Bases: View

A base class view for views that disable atomicity in requests.

dispatch(request, *args, **kwargs)#

Disable atomicity for the view.

Since we have settings.ATOMIC_REQUESTS enabled, Django wraps all view functions in an atomic transaction, so they can be rolled back if anything fails.

However, we need to be able to save data in the middle of get/post(), so that it’s available for calls to external APIs. To allow this, we need to disable atomicity at the top dispatch level.

class enterprise.views.ProgramEnrollmentView(**kwargs)#

Bases: NonAtomicView

Enterprise Program Enrollment landing page view.

This view will display information pertaining to program enrollment, including the Enterprise offering the program, its (reduced) price, the courses within it, and whether one is already enrolled in them, and other several pieces of Enterprise context.

static extend_course(course, enterprise_customer, request)#

Extend a course with more details needed for the program landing page.

In particular, we add the following:

  • course_image_uri

  • course_title

  • course_level_type

  • course_short_description

  • course_full_description

  • course_effort

  • expected_learning_items

  • staff

get(request, enterprise_uuid, program_uuid)#

Show Program Landing page for the Enterprise’s Program.

Render the Enterprise’s Program Enrollment page for a specific program. The Enterprise and Program are both selected by their respective UUIDs.

Unauthenticated learners will be redirected to enterprise-linked SSO.

A 404 will be raised if any of the following conditions are met:
  • No enterprise customer UUID query parameter enterprise_uuid found in request.

  • No enterprise customer found against the enterprise customer

    uuid enterprise_uuid in the request kwargs.

  • No Program can be found given program_uuid either at all or associated with

    the Enterprise..

get_enterprise_program_enrollment_page(request, enterprise_customer, program_details)#

Render Enterprise-specific program enrollment page.

get_program_details(request, program_uuid, enterprise_customer)#

Retrieve fundamental details used by both POST and GET versions of this view.

Specifically:

  • Take the program UUID and get specific details about the program.

  • Determine whether the learner is enrolled in the program.

  • Determine whether the learner is certificate eligible for the program.

post(request, enterprise_uuid, program_uuid)#

Process a submitted track selection form for the enterprise.

class enterprise.views.RouterView(**kwargs)#

Bases: NonAtomicView

A router or gateway view for managing Enterprise workflows.

COURSE_ENROLLMENT_VIEW_URL = '/enterprise/{}/course/{}/enroll/'#
PROGRAM_ENROLLMENT_VIEW_URL = '/enterprise/{}/program/{}/enroll/'#
VIEWS = {'/enterprise/handle_consent_enrollment/{}/course/{}/': <class 'enterprise.views.HandleConsentEnrollment'>, '/enterprise/{}/course/{}/enroll/': <class 'enterprise.views.CourseEnrollmentView'>, '/enterprise/{}/program/{}/enroll/': <class 'enterprise.views.ProgramEnrollmentView'>}#
eligible_for_direct_audit_enrollment(request, enterprise_customer, resource_id, course_key=None)#

Return whether a request is eligible for direct audit enrollment for a particular enterprise customer.

‘resource_id’ can be either course_run_id or program_uuid. We check for the following criteria: - The audit query parameter. - The user’s being routed to the course enrollment landing page. - The customer’s catalog contains the course in question. - The audit track is an available mode for the course.

get(request, *args, **kwargs)#

Run some custom GET logic for Enterprise workflows before routing the user through existing views.

In particular, before routing to existing views:

  • If the requested resource is a course, find the current course run for that course, and make that course run the requested resource instead.

  • Look to see whether a request is eligible for direct audit enrollment, and if so, directly enroll the user.

static get_course_run_id(user, enterprise_customer, course_key)#

User is requesting a course, we need to translate that into the current course run.

Parameters:
  • user

  • enterprise_customer

  • course_key

Returns:

course_run_id

static get_path_variables(**kwargs)#

Get the base variables for any view to route to.

Currently gets: - enterprise_uuid - the UUID of the enterprise customer. - course_run_id - the ID of the course, if applicable. - program_uuid - the UUID of the program, if applicable.

post(request, *args, **kwargs)#

Run some custom POST logic for Enterprise workflows before routing the user through existing views.

redirect(request, *args, **kwargs)#

Redirects to the appropriate view depending on where the user came from.

exception enterprise.views.VerifiedModeUnavailableException#

Bases: Exception

Exception that indicates the verified enrollment mode has expired or is otherwise unavaible for a course run.

enterprise.views.add_reason_to_failure_url(base_failure_url, failure_reason)#

Adds a query param to the given base_failure_url indicating why an enrollment has failed.

enterprise.views.get_global_context(request, enterprise_customer=None)#

Get the set of variables that are needed by default across views.

enterprise.views.get_price_text(price, request)#

Return the localized converted price as string (ex. ‘$150 USD’).

If the local_currency switch is enabled and the users location has been determined this will convert the given price based on conversion rate from the Catalog service and return a localized string

enterprise.views.get_safe_redirect_url(url, requires_https=None)#

Ensure that the URL which is going to be used for redirection exists in whitelist.

enterprise.views.render_page_with_error_code_message(request, context_data, error_code, exception=None, **kwargs)#

Return a 404 page with specified error_code after logging error and adding message to django messages.

enterprise.views.should_upgrade_to_licensed_enrollment(consent_record, license_uuid)#

In the event that a learner did enroll into audit from B2C and they consented on the data sharing consent page, we want to upgrade their audit enrollment into verified when they view the course in the learner portal and hit the DSC GET endpoint again.

enterprise.views.verify_edx_resources()#

Ensure that all necessary resources to render the view are present.

Module contents#

Your project description goes here.