Enterprise Django application initialization.
Bases: django.apps.config.AppConfig
Configuration for the enterprise Django application.
Return User model for django.contrib.auth.
Perform other one-time initialization steps.
Enterprise Django application constants.
Bases: object
Class to group modes that a course might have.
Bases: object
Class to group the default branding color codes. These color codes originated in the Enterprise Learner Portal.
serialized course modes.
Decorators for enterprise app.
Flag a method as deprecated.
extra – Extra text you’d like to display after the default text.
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
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 ...
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 ...
Ignore any emitted warnings from a function.
warning – The category of warning to ignore.
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.
Errors thrown by the APIs in the Enterprise application.
Bases: Exception
An exception that represents an error when creating admin notification read status via the NotificationReadApiClient.
Bases: Exception
There was a problem with a request to the Codes application’s APIs.
Bases: Exception
An exception that represents an error when modifying the state of an enrollment via the EnrollmentApiClient.
User-facing forms for the Enterprise app.
Bases: django.forms.forms.Form
Enterprise Slug Login Form.
Validate POST data.
Return all media required to render the widgets on this form.
Bases: django.forms.forms.Form
Enterprise Selection Form.
Validate POST data.
Return all media required to render the widgets on this form.
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.
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.
Add message to request indicating that there was an issue processing request.
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.
Add a message to the Django messages store indicating that we failed to retrieve price information about an item.
request – The current request.
item – The item for which price information is missing. Example: a program title, or a course.
Add a message to the Django message store indicating that the item (i.e. course run, program) is unenrollable.
request – The current request.
item – The item that is unenrollable (i.e. a course run).
Middleware for enterprise app.
Bases: django.utils.deprecation.MiddlewareMixin
Middleware for enterprise language preference.
Ensures that, once set, a user’s preferences are reflected in the page whenever they are logged in.
Check that the user is authenticated and belongs to an enterprise customer.
EnterpriseCustomer model.
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.
Database models for enterprise.
Bases: model_utils.models.TimeStampedModel
Model for Admin Notification.
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.
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.
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.
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.
Bases: model_utils.models.TimeStampedModel
Model for Admin Notification Filters.
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.
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.
Bases: model_utils.models.TimeStampedModel
Model for Admin Notification Read Status.
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.
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.
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.
Bases: config_models.models.ConfigurationModel
Manages configuration for a run of the cert_generation management command.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: model_utils.models.TimeStampedModel
Store optional templates to use when emailing users about course enrollment events.
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.
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.
Render both templates and return both.
Render just the HTML template and return it as a string.
Render just the plaintext template and return it as a string.
Create a template from the DB-backed text and render it.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
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.
Bases: model_utils.models.TimeStampedModel
Model for analytics users.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
Bases: model_utils.models.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 accross different catalogs.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Deletes this EnterpriseCatalogQuery
.
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.
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.
Bases: model_utils.models.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
.
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.
True if audit track data reporting is disabled, False otherwise.
Returns the student.CourseEnrollment
associated with this enterprise course enrollment record.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Return the EnterpriseCourseEnrollment object for a given user in given course_id.
Returns a list of UUID(s) for EnterpriseCustomer(s) that this enrollment links together with the user_id and course_run_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Returns True iff this enrollment is currently active.
Specify whether the course enrollment associated with this EnterpriseCourseEnrollment
is in audit mode.
Whether the course enrollment mode is of an audit type.
Returns the license associated with this enterprise course enrollment if one exists.
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.
Returns the mode of the student.CourseEnrollment
associated with this enterprise course enrollment record.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Bases: django.db.models.manager.Manager
Model manager for EnterpriseCourseEnrollment.
Override to return only those enrollment records for which learner is linked to an enterprise.
Bases: model_utils.models.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.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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 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.
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 if the specified course run is contained in enterprise customer catalogs.
Clear pending enrollments for the user in the given courses.
email – The email address which may have previously been used.
course_ids – An iterable containing any number of course IDs.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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'
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.
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.
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.
Return default_provider if associated with this enterprise customer.
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.
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.
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.
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.
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.
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.
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.
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.
enforcement_location (str) – the point where to see data sharing consent state.
'externally_managed' (argument can either be 'at_enrollment' or) –
Create pending enrollments for the user in any number of courses, which will take effect on registration.
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
The PendingEnterpriseCustomerUser attached to the email address
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.
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
The PendingEnterpriseCustomerUser attached to the email address new_enrollments (Dict): course ID keys and new enrollment status values.
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.
Returns the first instance from EnterpriseCustomerIdentityProvider relation.
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.
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.
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.
Return enterprise landing page url for the given course.
Return enterprise landing page url for the given course.
Return DataSharingConsentTextOverrides associated with this instance.
Return enterprise landing page url for the given program.
tpa_hint_param – query param passed in the URL.
tpa_hint to redirect
Return True if there are any identity providers associated with this enterprise customer.
Return True if there are multiple identity providers associated with this enterprise customer.
Return True if there are exactly one identity provider associated with this enterprise customer.
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.
Return the first identity provider id associated with this enterprise customer.
Return the identity provider Ids associated with this enterprise customer.
Return the identity providers associated with this enterprise customer.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Notify learners about a course in which they’ve been enrolled.
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
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.
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.
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.
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.
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 model without saving a historical record
Make sure you know what you’re doing before you use this method.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Return a serialized version of this 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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
True: a new EnterpriseCustomerInviteKey is created
False: all EnterpriseCustomerInviteKey are deactivated
enable_universal_link – new value
link_expiration_date – if passed when enable_universal_link is true new link will be created
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Bases: model_utils.models.TimeStampedModel
Model that keeps track of enterprise branding configurations e.g. enterprise customer logo.
enterprise_customer (ForeignKey[EnterpriseCustomer]) – enterprise customer
logo (ImageField) – enterprise customer image
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.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Returns an absolute URL for the branding configuration logo OR the platform logo absolute URL
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.
Bases: model_utils.models.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.
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.
Return true if this catalog contains the given programs.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Return the list of any content IDs specified in the catalog’s content filter.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
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.
Return content filter of the linked catalog query otherwise content filter of catalog itself.
Get all of the metadata for the given course.
Get course data and all of the metadata for the given course run.
Return enterprise course enrollment page url with the catalog information for the given course.
Get all of the metadata for the given course run.
Return enterprise course enrollment page url with the catalog information for the given course.
Return paginated discovery service search results without expired course runs.
Get all of the metadata for the given program.
Return enterprise program enrollment page url with the catalog information for the given program.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Saves this EnterpriseCatalogQuery
.
Copies the content_filter
of a related CatalogQuery into this
instance’s content_filter
if syncing is allowed.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
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.
Bases: model_utils.models.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:
An enterprise customer may or may not have an identity provider.
An enterprise customer can have more than one identity providers.
Enterprise customer site should match with identity provider’s site. (i.e. same domain names)
enterprise_customer (ForeignKey[EnterpriseCustomer]) – enterprise customer
provider_id (django.db.models.SlugField
) – The provider_id string of the identity provider.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Associated identity provider instance.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Readable name for the identity provider.
Return bool indicating if data received from the identity provider shoudl be synced to the edX profile.
Bases: model_utils.models.TimeStampedModel
, model_utils.models.SoftDeletableModel
Stores an invite key used to link a learner to an enterprise.
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.
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.
Returns whether the key is still valid (non-expired and usage limit has not been reached).
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.
Saves this EnterpriseCustomerInviteKey
.
Prevents is_active from being updated once it’s set to False.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
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.
Bases: django.db.models.manager.Manager
Model manager for EnterpriseCustomer
model.
Filters out inactive Enterprise Customers, otherwise works the same as default model manager.
Return a new QuerySet object. Filters out inactive Enterprise Customers.
Bases: model_utils.models.TimeStampedModel
The Enterprise’s configuration for sending automated data reports securely via email to the Enterprise Admin.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Override of clean method to perform additional validation on frequency, day_of_month/day_of week and compression.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Bases: model_utils.models.TimeStampedModel
Enterprise Customer Types are used to differentiate Enterprise learners.
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.
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.
Bases: model_utils.models.TimeStampedModel
Model that keeps track of user - enterprise customer affinity.
enterprise_customer (ForeignKey[EnterpriseCustomer
]) – enterprise customer
user_id (django.db.models.IntegerField
) – user identifier
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Create an order on the Ecommerce side for tracking the course enrollment of a enterprise customer user.
Return the DataSharingConsent records associated with this EnterpriseCustomerUser.
The filtered DataSharingConsent QuerySet.
QuerySet (DataSharingConsent)
Enroll a user into a course track, and register an 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.
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.
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
.
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
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Mark as inactive all the enterprise customers of given user except the given 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.
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.
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 model without saving a historical record
Make sure you know what you’re doing before you use this method.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Unenroll a user from a course track.
Update the session of a request for this learner.
Return User associated with this instance.
Return django.contrib.auth.models.User
instance associated with this
EnterpriseCustomerUser
instance via email.
Return linked user email.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Return linked user’s username.
Bases: django.db.models.manager.Manager
Model manager for EnterpriseCustomerUser
entity.
This class should contain methods that create, modify or query EnterpriseCustomerUser
entities.
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
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.
Bases: model_utils.models.TimeStampedModel
Define a Name and Source for all Enterprise Enrollment Sources.
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.
Retrieve the source based on the Slug provided.
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.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: edx_rbac.models.UserRole
Enterprise-specific feature role definitions.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: edx_rbac.models.UserRoleAssignment
Model to map users to an EnterpriseFeatureRole.
Get the enterprise customer uuids linked to the user.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
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).
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
alias of enterprise.models.EnrollmentNotificationEmailTemplate
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Get the next history record for the instance. None if last.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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 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'
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
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.
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.
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.
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.
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
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.
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.
alias of enterprise.models.EnterpriseCustomer
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
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.
URL for this change in the default admin site.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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.
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Get the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
URL for this change in the default admin site.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
alias of enterprise.models.LicensedEnterpriseCourseEnrollment
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
alias of enterprise.models.PendingEnrollment
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
alias of enterprise.models.PendingEnterpriseCustomerAdminUser
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Get the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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 the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin site.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: simple_history.models.HistoricalChanges
, django.db.models.base.Model
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.
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.
Returns the user specified by get_user method for manually creating historical objects
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
alias of enterprise.models.SystemWideEnterpriseUserRoleAssignment
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Get the next history record for the instance. None if last.
Get the previous history record for the instance. None if first.
URL for this change in the default admin 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.
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.
Bases: model_utils.models.TimeStampedModel
An Enterprise Course Enrollment that is enrolled via a license.
Returns a QuerySet of LicensedEnterpriseCourseEnrollments, along with their associated (hydrated) enterprise enrollments, users, and customers.
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.
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.
Marks this object as revoked and marks the associated EnterpriseCourseEnrollment as “saved for later”. This object and the associated EnterpriseCourseEnrollment are both saved.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
Bases: model_utils.models.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.
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.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
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.
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.
Bases: model_utils.models.TimeStampedModel
Model for pending enterprise admin users.
Returns a URL to be used by a pending enterprise admin user to register their account.
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.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Save model without saving a historical record
Make sure you know what you’re doing before you use this method.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: model_utils.models.TimeStampedModel
Model that stores “future members” of enterprise customer.
enterprise_customer (ForeignKey[EnterpriseCustomer
]) – enterprise customer
user_email (django.db.models.EmailField
) – user email
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.
Enrolls a newly created EnterpriseCustomerUser in any courses attached to their PendingEnterpriseCustomerUser record.
enterprise_customer_user – a EnterpriseCustomerUser instance
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.
is_user_created – a boolean whether the User instance was created or updated
user – a User instance
Returns: an EnterpriseCustomerUser instance
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 model without saving a historical record
Make sure you know what you’re doing before you use this method.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Bases: edx_rbac.models.UserRole
System wide user role definitions specific to Enterprise.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
Bases: edx_rbac.models.UserRoleAssignment
Model to map users to a SystemWideEnterpriseRole.
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.
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’, [‘*’])
Return a non-empty list of contexts for which self.user
is assigned self.role
.
Returns a mapping of role names to sets of enterprise customer uuids for which the user is assigned that role.
Returns true if the role for this assignment is ENTERPRISE_OPERATOR_ROLE
,
or if applies_to_all_contexts
is true; returns false otherwise.
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
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.
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 model without saving a historical record
Make sure you know what you’re doing before you use this method.
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.
Get default enterprise customer type id to use when creating a new EnterpriseCustomer model.
Python API for doing CRUD operations on roles and user role assignments.
Return the enterprise admin role.
Assigns the given user the enterprise_admin role in the given customer.
Assigns the given user the enterprise_learner role in the given customer.
Returns the enterprise catalog admin role.
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.
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.
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.
Gets or creates the SystemWideEnterpriseRole with the given name. Caches the result for 60 minutes in the Django cache. Returns the role object.
Returns the enterprise learner role.
Returns the enterprise openedx operator role.
Returns a mapping of system wide roles by name.
Rules needed to restrict access to the enterprise data api.
Django signal handlers.
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).
Watches for post_save signal for creates on the CourseEnrollment table.
Spin off an async task to generate an EnterpriseCourseEnrollment if appropriate.
Creates a PendingEnterpriseCustomerUser when a PendingEnterpriseCustomerAdminUser is created.
Set default value for EnterpriseCustomerCatalog.content_filter if not already set.
Delete the associated enterprise admin role assignment record when deleting an EnterpriseCustomerUser record.
Delete the associated enterprise analytics user in Tableau.
Send deletions of Enterprise Catalogs to the Enterprise Catalog Service.
Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.
Deletes a PendingEnterpriseCustomerUser when its associated PendingEnterpriseCustomerAdminUser is removed.
Handle User model changes. Context: This signal runs any time a user logs in, including b2c users.
Steps:
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.
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.
Delete the PendingEnterpriseCustomerUser record as its no longer needed.
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 and a Tableau user is created for the user.
Now that the object is instantiated and instance.id exists, save the image at correct path and re-save the model.
To avoid saving the logo image at an incorrect path, skip saving it.
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.
Sync data changes from Enterprise Catalog Query to the Enterprise Customer Catalog.
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.
Update the language preference of the learner. Set the language preference to the value enterprise customer has used as the default_language.
Django tasks.
Returns the EnterpriseCourseEnrollment
class.
This function is needed to avoid circular ref issues when model classes call tasks in this module.
Returns the EnterpriseCustomerUser
class.
This function is needed to avoid circular ref issues when model classes call tasks in this module.
Returns the EnterpriseEnrollmentSource
class.
This function is needed to avoid circular ref issues when model classes call tasks in this module.
Module provides elements to be used in third-party auth pipeline.
Return social auth entry of user for given enterprise default IDP.
user (User) – user object
enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.
user_idp_id (str) – User id of user in third party LMS
Get the EnterpriseCustomer associated with a running pipeline.
Get the EnterpriseCustomer object tied to an identity provider.
Helper method to retrieve the sso provider ID from either a user’s SSO login request
Find the LMS user from the LMS model UserSocialAuth.
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.
Return social auth entry of user for given enterprise.
user (User) – user object
enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.
Perform the linking of user in the process of logging to the Enterprise Customer.
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
Change the redirect url if user has more than 1 EnterpriseCustomer associations.
backend (User) – social auth backend object
user (User) – user object
Change the redirect url for the user to enterprise selection page.
Helper method to ensure that a customer’s provider config is validated
URLs for enterprise.
Utility functions for enterprise app.
Bases: Exception
Exception to raise when we we received data from Course Catalog but it contained an error.
Bases: Exception
Exception to raise when an enrollment attempts to enroll the user in an unpaid mode when they are in a paid mode.
Bases: Exception
Exception to raise when an enterprise attempts to use enrollment features it’s not configured to use.
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.
Bases: object
Namespace class for validation messages.
Associate a user with the group in tableau. The function attempts to create the group, except when the server responds with an exception code of 409009, indicating that the group already exists. In the latter case, the user is associated with the existing group.
Break up an iterable into equal-sized batches.
iterable (e.g. list) – an iterable to batch
batch_size (int) – the size of each batch. Defaults to 1.
iterates through each batch of an iterable
generator
Given html text that will be rendered as a variable in a template, strip out characters that impact rendering.
Create the user in tableau and store the tableau user in the EnterpriseAnalyticsUser model.
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)
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
Whether or not enrollment succeeded for the course specified
succeeded (Boolean)
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.
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
Whether or not the enrollment succeeded for the course specified created (Boolean): Whether or not the enrollment existed prior to calling method
succeeded (Boolean)
Delete the DSC records from the DB for given learner, course and customer, also its cache.
Delete the user in Tableau.
Delete the user in Tableau.
Return discovery url for preview.
Takes a list of licensed learner data and enrolls each learner in the requested courses.
enterprise_customer – The EnterpriseCustomer (object) which is sponsoring the enrollment
licensed_users_info –
(list) An array of dictionaries, each containing information necessary to create a licensed enterprise enrollment for a specific learner in a specified course run. Example:
licensed_users_info: [
{
'email': 'newuser@test.com',
'course_run_key': 'course-v1:edX+DemoX+Demo_Course',
'course_mode': 'verified',
'license_uuid': '5b77bdbade7b4fcb838f8111b68e18ae'
}
]
discount – (int) the discount offered to the learner for their enrollment. Subscription based enrollments default to 100
Expected Return Values:
Results: {
successes: [{ 'email': <email>, 'course_run_key': <key>, 'user': <user object> } ... ],
pending: [{ 'email': <email>, 'course_run_key': <key>, 'user': <user object> } ... ],
failures: [{ 'email': <email>, 'course_run_key': <key> } ... ]
}
Enroll a single user in any number of courses using a particular course mode.
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.
Whether or not enrollment succeeded for all courses specified
Boolean
Enroll existing users in a course, and create a pending enrollment for nonexisting users.
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.
A list of users who were successfully enrolled in the course.
linked and had pending enrollments created for them in the database.
failures: A list of users who could not be enrolled in the course.
successes
Returns the EnterpriseCourseEnrollment
class.
Returns the EnterpriseCustomerInviteKey
class.
Returns the EnterpriseCustomer
class.
Returns the EnterpriseCustomerUser
class.
Returns the EnterpriseEnrollmentSource
class.
Filter audit course modes out if the enterprise customer has not enabled the ‘Enable audit enrollment’ flag.
enterprise_customer – The EnterpriseCustomer that the enrollment was created using.
course_modes – iterable with dictionaries containing a required ‘mode’ key
Find email template from the template database represented by EnrollmentNotificationEmailTemplate model.
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
Customer specific template if found. Default template for the given type if found. None if neither default template, nor per customer template found.
Format the price to have the appropriate currency and digits..
price – The price amount.
currency – The currency for the price.
A formatted price string, i.e. ‘$10’, ‘$10.52’.
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’
Find the advertised course run for a given course :param course: course dict :type course: dict
a course_run or 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.
Helper method to retrieve a list of enrollments for a given course and select the one most applicable to enroll an enterprise learner in.
Wrapper method on edx_django_utils get_cache_key utility.
Get url to catalog details admin page.
catalog_id (int) – Catalog id for which to return catalog details url.
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/"
Get template of catalog admin url.
URL template will contain a placeholder ‘{catalog_id}’ for catalog id. :param mode e.g. change/add.:
A string containing template for catalog url.
Example
>>> get_catalog_admin_url_template('change')
"http://localhost:18381/admin/catalogs/catalog/{catalog_id}/change/"
Return course run with start date closest to now.
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.
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.
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
The value located at that key in the site configuration or settings file.
Return the unique identifier given a content metadata item dictionary.
Return course run’s duration(str) info.
Return the given course run’s start date as a datetime.
Return track selection url for the given course.
Get or Create the Enterprise Course Enrollment.
If license_uuid
present, will also create a LicensedEnterpriseCourseEnrollment record.
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.
Return default enterprise customer catalog content filter.
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
in days or 0 start: start field of closest course run item, or None end: end field of closest course run item, or None
duration
Return the user object of ecommerce worker user.
Get the EnterpriseCustomer
instance associated with uuid
.
uuid – The universally unique ID of the enterprise customer.
The EnterpriseCustomer
instance, or None
if it doesn’t exist.
Given an EnterpriseCustomerInviteKey UUID, return the corresponding EnterpriseCustomer or raise a 404.
invite_key_uuid (str) – The UUID identifying an EnterpriseCustomerInviteKey.
The EnterpriseCustomer given the EnterpriseCustomerInviteKey UUID.
Given an EnterpriseCustomer slug, return the corresponding EnterpriseCustomer or raise a 404.
slug (str) – The unique slug (a string) identifying the customer.
The EnterpriseCustomer given the slug.
Return first found enterprise customer instance for given user.
if given user is associated with any enterprise customer, return first enterprise customer.
otherwise return None.
auth_user (contrib.auth.User) – Django User
enterprise customer associated with the current user.
Given an EnterpriseCustomer UUID, return the corresponding EnterpriseCustomer or raise a 404.
enterprise_uuid (str) – The UUID (in string form) of the EnterpriseCustomer to fetch.
The EnterpriseCustomer given the UUID.
Return the object for EnterpriseCustomerUser.
user_id (str) – user identifier
enterprise_uuid (UUID) – Universally unique identifier for the enterprise customer.
enterprise customer user record
Get the UTM context for the enterprise.
Get the EnterpriseCustomer
UUID(s) associated with a user and a course id``.
if given user is enrolled in a specific course via an enterprise customer enrollment, return related enterprise customers as a list.
otherwise return empty list.
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
enterprise customer uuids associated with the current user and course run or None
(list of str)
Return the user object of enterprise worker user.
Get Identity Provider with given id.
Instance of ProviderConfig or None.
Returns a list containing lower case difference of list_b and list_a after case insensitive comparison.
list_a – list of strings
list_b – list of string
List of unique lower case strings computed by subtracting list_b from list_a.
Get a list of identity providers choices for enterprise customer.
A list of choices of all identity providers, None if it can not get any available identity provider.
Return IETF language tag of given language name.
if language is not found in the language map then en-US is returned.
language (str) – string language name
Returns: a language tag (two-letter language code - two letter country code if applicable)
Returns the end date of the course run that falls at the end.
Learner portal url for enterprise_customer
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.
course_name (str) – Course name to be rendered into the string
template_configuration – A database-backed object with a stored subject line template
Return oauth2 authentication class to authenticate REST APIs with Bearer token.
Return an absolute URL of the platform logo using the branding api.
Get the pre-set description associated with this program type.
program_type – The type of the program. Should be one of:
“MicroMasters Certificate”
“Professional Certificate”
“XSeries Certificate”
The description associated with the program type. If none exists, then the empty string.
Get the value in the request, either through query parameters or posted data, from a key.
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.
The value we’re looking for.
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
Return Tableau ServerAuth and Server instances or None
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
Accept a list of emails, and separate them into users that exist on OpenEdX and users who don’t.
emails – An iterable of email addresses to split between existing and nonexisting
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
users
Iterates over all course runs to check if there any course run that is available for enrollment.
course_runs: list of course runs
True if found else false
Return False if end - now > course run’s weeks to complete otherwise True.
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
True if course run is “active”
Check if a course run is available for enrollment.
Return true if the course run is enrollable, false otherwise.
We look for the following criteria:
A reasonably-defined enrollment window is 1 day before course run end date.
enrollment_start is less than now, or undefined.
enrollment_end is greater than now, or undefined.
Return True if the course run’s status value is “published”.
Return true if the course run has a verified seat with an unexpired upgrade deadline, false otherwise.
Returns true if pending_user attributes are detected
Query the enrollment API and determine if a learner is enrolled in a given course run track.
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.
Whether or not enrollment exists
Boolean
Return where the specified URL is a valid absolute url.
returns the LicensedEnterpriseCourseEnrollment
class.
Helper function to return localized utcnow().
Returns the enterprise customer logo image path.
instance (EnterpriseCustomerBrandingConfiguration
) – EnterpriseCustomerBrandingConfiguration object
filename (str) – file to upload
path of image file e.g. enterprise/branding/<enterprise_uuid>/logo_<uuid>.<ext>.lower()
path
Return the parsed version of a datetime string. If the string is invalid, return None.
Parse a received datetime into a timezone-aware, Python datetime object.
datetime_string – A string to be parsed.
datetime_format – A datetime format string to be used for parsing
Send an email notifying a user about their enrollment in a course.
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.
Prepare serializable contents to send emails with (if using tasks to send emails)
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,
}
1: { ‘first_name’: name, ‘username’: user_name, ‘email’: email } (dict of User object)
2: { ‘user_email’ : user_email } (dict of PendingEnterpriseCustomerUser object)
Strip all tags from a string except those tags provided in allowed_tags parameter.
Returns: a string without html tags
Emit a track event for enterprise course enrollment.
Emit a track event when user is linked to an enterprise
Emit a track event to segment (and forwarded to GA) for some parts of the Enterprise workflows.
Traverse a paginated API response.
Extracts and concatenates “results” (list of dict) returned by DRF-powered APIs.
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.
list of dict.
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.
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.
Unset the language preference of the given enterprise learners.
enterprise_customer_user (EnterpriseCustomerUser) – Instance of the enterprise customer user.
Unset the language preference of all the learners belonging to the given enterprise customer.
enterprise_customer (EnterpriseCustomer) – Instance of the enterprise customer.
Return url with updated query parameters.
users associated the enterprise customer of the given user.
(slug)
Validates that a specified course id exists within the LMS and within the enterprise_customer’s catalog(s).
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.
Checks that email is valid
Checks that it is not already linked to the provided Enterprise Customer
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
ValidationError – if email is invalid or already linked to Enterprise Customer.
Whether or not there is an existing record with the same email address.
Database models field validators.
:return Application configuration.
Validate particular fields (if present) passed in through content_filter are certain types.
Validate value is suitable for a color hex value.
Validate that a particular image extension.
Validate that a particular image size.
User-facing views for the Enterprise app.
Bases: enterprise.views.NonAtomicView
Enterprise landing page view.
This view will display the course mode selection with related enterprise information.
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.
No enterprise customer uuid kwarg enterprise_uuid in request.
uuid enterprise_uuid in the request kwargs.
No course is found in database against the provided course_id.
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”.
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.
Render enterprise-specific course track selection page.
Process a submitted track selection form for the enterprise.
Set the final discounted price on each premium mode.
Bases: django.views.generic.edit.FormView
Allow an enterprise learner to login by enterprise customer’s slug login.
alias of enterprise.forms.EnterpriseLoginForm
If the form is invalid then return the errors.
If the form is valid, redirect to the third party auth login page.
Return the context data needed to render the view.
Bases: django.views.generic.base.View
Allows an enterprise learner to login via existing flow from the learner portal.
Redirects a learner through login with their enterprise’s third party auth if it uses tpa.
Bases: django.views.generic.edit.FormView
Allow an enterprise learner to activate one of learner’s linked enterprises.
If the form is invalid then return the errors.
If the form is valid, activate the selected enterprise.
Return the context data needed to render the view.
Return the initial data to use for forms on this view.
Bases: tuple
Alias for field number 0
Alias for field number 1
Bases: django.views.generic.base.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.
Return whether the input course or program exist.
Create EnterpriseCustomerUser and EnterpriseCourseEnrollment record if not already exists.
Render a form to collect user input about data sharing consent.
Make set of variables(populated from db) that will be used in data sharing consent page.
Return a dict having course or program specific keys for data sharing consent page.
Get the set of variables that will populate the template by default.
Return a dict of data for the language on the page.
Returns True if the course_id is in the correct format of a course_run_id, false otherwise.
course_id (str) – The course_key or course run id
True or False
(Boolean)
Process the above form.
Bases: django.views.generic.base.View
Handle enterprise course enrollment at providing data sharing consent.
View handles the case for enterprise course enrollment after successful consent.
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.
Bases: django.views.generic.base.View
A base class view for views that disable atomicity in requests.
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.
Bases: enterprise.views.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.
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
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.
No enterprise customer UUID query parameter enterprise_uuid
found in request.
uuid enterprise_uuid
in the request kwargs.
program_uuid
either at all or associated withthe Enterprise..
Render Enterprise-specific program enrollment page.
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.
Process a submitted track selection form for the enterprise.
Bases: enterprise.views.NonAtomicView
A router or gateway view for managing Enterprise workflows.
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.
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.
User is requesting a course, we need to translate that into the current course run.
user –
enterprise_customer –
course_key –
course_run_id
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.
Run some custom POST logic for Enterprise workflows before routing the user through existing views.
Redirects to the appropriate view depending on where the user came from.
Bases: Exception
Exception that indicates the verified enrollment mode has expired or is otherwise unavaible for a course run.
Adds a query param to the given base_failure_url
indicating
why an enrollment has failed.
Get the set of variables that are needed by default across views.
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
Ensure that the URL which is going to be used for redirection exists in whitelist.
Return a 404 page with specified error_code after logging error and adding message to django messages.
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.
Ensure that all necessary resources to render the view are present.
Your project description goes here.