'Create, read, or update enrollment information for a user.
HTTP Endpoint for all CRUD operations for a user course enrollment. Allows creation, reading, and
updates of the current enrollment for a particular course.
Args:
request (Request): To get current course enrollment information, a GET request will return
information for the current user and the specified course.
course_id (str): URI element specifying the course location. Enrollment information will be
returned, created, or updated for this particular course.
username (str): The username associated with this enrollment request.
Return:
A JSON serialized representation of the course enrollment.'

@method_decorator(ensure_csrf_cookie_cross_domain)
def get(self, request, course_id=None, username=None):

    username = (username or request.user.username)
    if ((request.user.username != username) and (not self.has_api_key_permissions(request)) and (not request.user.is_staff)):
        return Response(status=status.HTTP_404_NOT_FOUND)
    try:
        return Response(api.get_enrollment(username, course_id))
    except CourseEnrollmentError:
        return Response(status=status.HTTP_400_BAD_REQUEST, data={'message': u"An    error    occurred    while    retrieving    enrollments    for    user    '{username}'    in    course    '{course_id}'".format(username=username, course_id=course_id)})
