Custom Django Admin actions used in enterprise app.
Return an export csv action.
description (string) – action description
fields ([string]) – list of model fields to include
header (bool) – whether or not to output the column names as the first row
Kicks off background running tasks for refreshing catalogs
Forms to be used in the enterprise djangoapp.
Bases: django.forms.models.ModelForm
Alternate form for AdminNotification.
Bases: object
alias of enterprise.models.AdminNotification
start_date and expiration_date are mandatory.
start_date must always come before the expiration_date.
There must be only one admin notification in a date range.
Return all media required to render the widgets on this form.
Bases: config_models.admin.ConfigurationModelAdmin
Admin form for the BulkCatalogQueryUpdateCommandConfiguration model
Bases: django.forms.models.ModelForm
Alternate form for the EnterpriseCustomer admin page.
Bases: object
alias of enterprise.models.EnterpriseCustomer
Return all media required to render the widgets on this form.
Bases: django.forms.models.ModelForm
form for EnterpriseCustomerCatalogAdmin class.
Return the uuid of the catalog the preview button was clicked on There must be only one preview button in the POST data.
e.g: ‘enterprise_customer_catalogs-0-preview_button’
Return all media required to render the widgets on this form.
Bases: django.forms.models.ModelForm
Alternate form for the EnterpriseCustomerIdentityProvider admin page.
This form fetches identity providers from lms third_party_auth app. If third_party_auth app is not avilable it displays provider_id as a CharField.
Bases: object
alias of enterprise.models.EnterpriseCustomerIdentityProvider
Final validations of model fields.
Validate that selected site for enterprise customer matches with the selected identity provider’s site.
Return all media required to render the widgets on this form.
Bases: django.forms.models.ModelForm
Alternate form for the EnterpriseCustomerReportingConfiguration admin page.
This form uses the PasswordInput widget to obscure passwords as they are being entered by the user.
Bases: object
alias of enterprise.models.EnterpriseCustomerReportingConfiguration
Override of clean method to perform additional validation
Return all media required to render the widgets on this form.
Bases: edx_rbac.admin.forms.UserRoleAssignmentAdminForm
Form for EnterpriseFeatureUserRoleAssignments.
Bases: object
alias of enterprise.models.EnterpriseFeatureUserRoleAssignment
Return all media required to render the widgets on this form.
Bases: django.forms.forms.Form
Form to request DSC from a learner.
Bases: object
Namespace class for field names.
Verify course ID has an associated course in LMS.
Verify email_or_username has associated user in our database.
Check whether course exists in enterprise customer catalog.
Check whether user is linked to the enterprise customer or not.
Return all media required to render the widgets on this form.
Bases: django.forms.forms.Form
Form to manage learner additions.
Bases: object
Namespace class for CSV column names.
Bases: object
Namespace class for field names.
Bases: object
Namespace class for form modes.
Bases: object
Namespace class for notification types
Clean fields that depend on each other.
In this case, the form can be used to link single user or bulk link multiple users. These are mutually exclusive modes, so this method checks that only one field is passed.
Verify course ID and retrieve course details.
Verify that discount value should be from 0 to 100.
Clean email form field
the cleaned value, converted to an email address (or an empty string)
Clean the notify_on_enrollment field.
Clean the reason for enrollment field
Return all media required to render the widgets on this form.
Bases: edx_rbac.admin.forms.UserRoleAssignmentAdminForm
Form for SystemWideEnterpriseUserRoleAssignments.
Bases: object
alias of enterprise.models.SystemWideEnterpriseUserRoleAssignment
Return all media required to render the widgets on this form.
Bases: django.forms.forms.Form
Form to transmit courses metadata for enterprise customers.
Clean enterprise channel worker user form field
the cleaned value of channel user username for transmitting courses metadata.
Return all media required to render the widgets on this form.
Custom paginator to implement smart pagination.
Bases: django.core.paginator.Paginator
Adopted from django/core/paginator so as to implement smart links pagination in custom views.
We have customized the getter so that it can return the value of the page_range property instead of always calculating the result.
Admin utilities.
Bases: object
Collection on URL names used in admin
Convert email_or_username to email.
as is.
Returns paginated list.
Adopted from django/contrib/admin/templatetags/admin_list.py https://github.com/django/django/blob/1.11.1/django/contrib/admin/templatetags/admin_list.py#L50
Parse csv file and return a stream of dictionaries representing each row.
First line of CSV file must contain column headers.
file_stream – input file
expected_columns (set[unicode]) – columns that are expected to be present
dict – CSV line parsed into a dictionary.
Split the contents of the email field into a list.
In some cases, a user could enter a comma-separated value inline in the Manage Learners form. We should check to see if that’s the case, and provide a list of email addresses or usernames if it is.
Validate csv file for encoding and expected header.
file_stream – input file
expected_columns – list of column names that are expected to be present in csv
an iterable for csv datat if csv passes the validation
reader
ValidationError –
Custom Django Admin views used in enterprise app.
Bases: django.views.generic.base.View
Base class for Enterprise Customer views.
render the form with appropriate context.
Bases: enterprise.admin.views.BaseEnterpriseCustomerView
Manage Learners Data Sharing Consent View.
Allows to request the DSC from a learner for a specific course.
Bases: object
Namespace-style class for custom context parameters.
Handle GET request - render “Request a DSC from Learner” form.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
HttpResponse
django.http.response.HttpResponse
Handle POST request - handle form submissions.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
Bases: enterprise.admin.views.BaseEnterpriseCustomerView
Manage Learners view.
Lists learners linked to chosen Enterprise Customer and allows adding and deleting them.
Bases: object
Namespace-style class for custom context parameters.
Handle DELETE request - handle unlinking learner.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
HttpResponse
django.http.response.HttpResponse
Handle GET request - render linked learners list and “Link learner” form.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
HttpResponse
django.http.response.HttpResponse
Get the list of EnterpriseCustomerUsers we want to render.
request (HttpRequest) – HTTP Request instance.
search_keyword (str) – The keyword to search for in users’ email addresses and usernames.
customer_uuid (str) – A unique identifier to filter down to only users linked to a
EnterpriseCustomer. (particular) –
page_size (int) – Number of learners displayed in each paginated set.
Create message for the users who were not able to be enrolled in a course.
users – An iterable of users who were not successfully enrolled
enrolled_in (str) – A string identifier for the course with which enrollment was attempted
Returns: tuple: A 2-tuple containing a message type and message text
Create message for the users who were enrolled in a course.
Get the list of PendingEnterpriseCustomerUsers we want to render.
Retrieve the search querystring from the GET parameters.
Create message for the users who were enrolled in a course.
Handle POST request - handle form submissions.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
HttpResponse
django.http.response.HttpResponse
Deduplicate any outgoing message requests, and send the remainder.
http_request – The HTTP request in whose response we want to embed the messages
message_requests – A list of undeduplicated messages in the form of tuples of message type and text- for example, (‘error’, ‘Something went wrong’)
Bases: enterprise.admin.views.BaseEnterpriseCustomerView
Transmit courses view.
Allows transmitting of courses metadata for provided enterprise.
Bases: object
Namespace-style class for custom context parameters.
Handle GET request - render “Transmit courses metadata” form.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
HttpResponse
django.http.response.HttpResponse
Handle POST request - handle form submissions.
request (django.http.request.HttpRequest) – Request instance
customer_uuid (str) – Enterprise Customer UUID
Bases: django.views.generic.base.View
Renders a given NotificationTemplate object to HTML for online viewing.
Render the given template with the stock data.
Get a human-readable name for the user.
Widgets to be used in the enterprise djangoapp.
Django admin integration for enterprise app.
Bases: django.contrib.admin.options.ModelAdmin
Django admin for AdminNotification model.
alias of enterprise.models.AdminNotification
Bases: django.contrib.admin.options.ModelAdmin
Django admin for AdminNotificationFilter model.
Bases: django.contrib.admin.options.ModelAdmin
Django admin for AdminNotificationRead model.
Bases: django.core.paginator.Paginator
A paginator that uses INFORMATION_SCHEMA.TABLES to estimate the total number of rows in a table.
Returns the number of items in the object list (possibly an estimate).
Bases: django_object_actions.utils.DjangoObjectActions
, django.contrib.admin.options.ModelAdmin
Django admin for EnrollmentNotificationEmailTemplate model
Bases: object
alias of enterprise.models.EnrollmentNotificationEmailTemplate
Returns the additional urls used by the custom object tools.
Object tool handler method - redirects to “Preview” view
Redirect to preview the HTML template in the context of a course.
Redirect to preview the HTML template in the context of a program.
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCatalogQuery.
Return discovery url for preview.
Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.
Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCourseEnrollment
Override to conditionally show the button.
Append Enrollment Attribute Override view url with default urls
Disable add permission for EnterpriseCourseEnrollment.
Disable deletion for EnterpriseCourseEnrollment.
Return the subscription license UUID (if any exists) associated with this enrollment.
Bases: django_object_actions.utils.DjangoObjectActions
, simple_history.admin.SimpleHistoryAdmin
Django admin model for EnterpriseCustomer.
Bases: object
alias of enterprise.models.EnterpriseCustomer
Return True if data sharing consent is enabled for EnterpriseCustomer.
instance (enterprise.models.EnterpriseCustomer) – EnterpriseCustomer model instance
Retrieve the appropriate form to use, saving the request user into the form for use in loading catalog details
Return a tuple containing a queryset to implement the search and a boolean indicating if the results may contain duplicates.
Returns the additional urls used by the custom object tools.
Return True if EnterpriseCustomer has related identity provider.
instance (enterprise.models.EnterpriseCustomer) – EnterpriseCustomer model instance
Return True if EnterpriseCustomer has a logo.
instance (enterprise.models.EnterpriseCustomer) – EnterpriseCustomer model instance
Object tool handler method - redirects to “Manage Learners” view
Object tool handler method - redirects to “Clear Learners Data Sharing Consent” view
Object tool handler method - redirects to Transmit Courses Metadata view.
Bases: django.contrib.admin.options.StackedInline
Django admin model for EnterpriseCustomerBrandingConfiguration.
The admin interface has the ability to edit models on the same page as a parent model. These are called inlines. https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.StackedInline
alias of enterprise.models.EnterpriseCustomerBrandingConfiguration
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCustomerCatalog.
Disallow the delete selected action as that does not send a DELETE request to enterprise-catalog
Return a Form class for use in the admin add view. This is used by add_view and change_view.
Return enterprise catalog url for preview.
Inject html for disabling wrap for uuid
Bases: django.contrib.admin.options.TabularInline
Django admin model for EnterpriseCustomerCatalog. The admin interface has the ability to edit models on the same page as a parent model. These are called inlines. https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.StackedInline
Return a BaseInlineFormSet class for use in admin add/change views.
Bases: django.contrib.admin.options.StackedInline
Django admin model for EnterpriseCustomerIdentityProvider.
The admin interface has the ability to edit models on the same page as a parent model. These are called inlines. https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.StackedInline
alias of enterprise.models.EnterpriseCustomerIdentityProvider
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCustomerInviteKey.
Hook for specifying custom readonly fields.
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCustomerReportingConfiguration.
Bases: object
alias of enterprise.models.EnterpriseCustomerReportingConfiguration
Return the fields that should be displayed on the admin form.
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCustomerType.
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for EnterpriseCustomerUser.
Return a string representing a given EnterpriseCustomerUser’s enterprise course enrollments
enterprise_customer_user – The instance of EnterpriseCustomerUser being rendered with this admin form.
Get an HTML string representing the courses the user is enrolled in.
Returns the name of enterprise customer linked with the enterprise customer user.
Make all fields readonly when editing existing model.
Return a tuple containing a queryset to implement the search and a boolean indicating if the results may contain duplicates.
Return a string representing a given EnterpriseCustomerUser’s non-enterprise course enrollments
enterprise_customer_user – The instance of EnterpriseCustomerUser being rendered with this admin form.
Bases: edx_rbac.admin.UserRoleAssignmentAdmin
Django admin model for EnterpriseFeatureUserRoleAssignment.
Bases: object
alias of enterprise.models.EnterpriseFeatureUserRoleAssignment
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for PendingEnrollment
Bases: object
alias of enterprise.models.PendingEnrollment
Disable add permission for PendingEnrollment.
Disable deletion for PendingEnrollment.
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for PendingEnterpriseCustomerAdminUser
Bases: object
alias of enterprise.models.PendingEnterpriseCustomerAdminUser
Formats the admin_registration_url
model property as an HTML link.
Returns the name of the associated EnterpriseCustomer.
Bases: django.contrib.admin.options.TabularInline
Django admin inline model for PendingEnterpriseCustomerAdminUser.
Formats the admin_registration_url
model property as an HTML link.
alias of enterprise.models.PendingEnterpriseCustomerAdminUser
Bases: django.contrib.admin.options.ModelAdmin
Django admin model for PendingEnterpriseCustomerUser
Bases: edx_rbac.admin.UserRoleAssignmentAdmin
Django admin model for SystemWideEnterpriseUserRoleAssignment.
Bases: object
alias of enterprise.models.SystemWideEnterpriseUserRoleAssignment
Return the comma separated names of all enterprise customers attached to the user.
instance (SystemWideEnterpriseUserRoleAssignment) – model instance
Adds help text to the callable-defined effective_enterprise_customer
field.