lms.djangoapps.instructor_task.rest_api.v1 package#

Submodules#

lms.djangoapps.instructor_task.rest_api.v1.exceptions module#

Exception classes for Instructor Task REST APIs.

exception lms.djangoapps.instructor_task.rest_api.v1.exceptions.TaskUpdateException#

Bases: Exception

An exception that occurs when trying to update an instructor task instance. This covers scenarios where an updated task schedule is not valid, or we are trying to update a task that has already been processed (is no longer in the SCHEDULED state).

lms.djangoapps.instructor_task.rest_api.v1.permissions module#

Instructor Task Django app REST API permission classes.

class lms.djangoapps.instructor_task.rest_api.v1.permissions.CanViewOrModifyScheduledBulkCourseEmailTasks#

Bases: BasePermission

Permission class that ensures a user is allowed to interact with the bulk course messages in a given course-run.

has_permission(request, view)#

Only course-staff/instructors or staff users should be able to modify the bulk course email messages or schedules.

lms.djangoapps.instructor_task.rest_api.v1.serializers module#

Instructor Task Django app REST API serializers.

class lms.djangoapps.instructor_task.rest_api.v1.serializers.CourseEmailSerializer(*args, **kwargs)#

Bases: ModelSerializer

Serializer for the course email instance belonging to each scheduled task.

class Meta#

Bases: object

course_email_model#

alias of CourseEmail

fields = ('id', 'subject', 'html_message', 'text_message', 'course_id', 'to_option', 'sender', 'targets')#
model#

alias of CourseEmail

class lms.djangoapps.instructor_task.rest_api.v1.serializers.ScheduledBulkEmailSerializer(*args, **kwargs)#

Bases: ModelSerializer

Serializer for scheduled bulk email instructor tasks.

class Meta#

Bases: object

fields = ('id', 'course_email', 'task', 'task_due')#
model#

alias of InstructorTaskSchedule

get_course_email(obj)#

This function is responsible for retrieving and including course email instance information associated with each individual scheduled task. Uses the task related to the schedule to extract the email id of the scheduled message. From here we can lookup the individual message and attach it with the other API results.

class lms.djangoapps.instructor_task.rest_api.v1.serializers.SenderField(*args, **kwargs)#

Bases: RelatedField

Serializer field that converts the user object id to a human readable name (username)

to_representation(value)#

Transform the outgoing native value into primitive data.

class lms.djangoapps.instructor_task.rest_api.v1.serializers.TargetListField(*args, **kwargs)#

Bases: RelatedField

Serializer field that converts the email target values (recipient groups) of a message from an int to a human readable name.

to_representation(value)#

Transform the outgoing native value into primitive data.

lms.djangoapps.instructor_task.rest_api.v1.urls module#

Instructor Task Django app REST API URLs.

lms.djangoapps.instructor_task.rest_api.v1.views module#

Instructor Task Django app REST API views.

class lms.djangoapps.instructor_task.rest_api.v1.views.ListScheduledBulkEmailInstructorTasks(**kwargs)#

Bases: ListAPIView

Read only view to list all scheduled bulk email messages for a course-run.

Path: GET api/instructor_task/v1/schedules/{course_id}/bulk_email

Returns:

OK - Contains a list of all scheduled bulk email instructor tasks that haven’t been executed yet. This

data also includes information about the and course email instance associated with each task.

  • 403: User does not have the required role to view this data.

Return type:

  • 200

get_queryset()#

Filters the results so that only scheduled bulk email tasks for the specific course-run are returned.

permission_classes = (<class 'lms.djangoapps.instructor_task.rest_api.v1.permissions.CanViewOrModifyScheduledBulkCourseEmailTasks'>,)#
serializer_class#

alias of ScheduledBulkEmailSerializer

class lms.djangoapps.instructor_task.rest_api.v1.views.ModifyScheduledBulkEmailInstructorTask(**kwargs)#

Bases: DestroyAPIView, UpdateAPIView

A view that supports the modification of instructor task schedules. It provides the ability to:
  • Delete an instructor task schedule

  • Update an instructor task schedule and/or update the course email associated with the scheduled task.

Path: DELETE or PATCH api/instructor_task/v1/schedules/{course_id}/bulk_email/{task_schedule_id}

Returns:

The schedule or email content was updated successfully. * 204: No Content - Deleting the schedule was successful. * 400: Bad request - Updating the email content or schedule failed due to bad data in the request. * 403: User does not have permission to modify the object specified. * 404: Requested schedule object could not be found and thus could not be modified or removed.

Return type:

  • 200

destroy(request, *args, **kwargs)#
patch(request, *args, **kwargs)#
permission_classes = (<class 'lms.djangoapps.instructor_task.rest_api.v1.permissions.CanViewOrModifyScheduledBulkCourseEmailTasks'>,)#
serializer_class#

alias of ScheduledBulkEmailSerializer

Module contents#