lms.djangoapps.user_tours.v1 package#
Submodules#
lms.djangoapps.user_tours.v1.serializers module#
Serializer for UserTourView.
- class lms.djangoapps.user_tours.v1.serializers.UserDiscussionsToursSerializer(*args, **kwargs)#
Bases:
ModelSerializerSerializer for UserDiscussionsTours model.
- class Meta#
Bases:
object- fields = ['id', 'tour_name', 'show_tour', 'user']#
- model#
alias of
UserDiscussionsTours
- to_representation(instance)#
Object instance -> Dict of primitive datatypes.
lms.djangoapps.user_tours.v1.views module#
API for User Tours.
- class lms.djangoapps.user_tours.v1.views.UserDiscussionsToursView(**kwargs)#
Bases:
APIViewSupports retrieving and patching the UserDiscussionsTours model returns a list of available tours and their status
- Example Requests
GET /api/user_tours/v1/discussions/ PUT /api/user_tours/v1/discussions/{tour_id}
Example Response: [
- {
“id”: 1, “tour_name”: “discussions”, “show_tour”: true, “user”: 1
}
]
- get(request, tour_id=None)#
Return a list of all tours in the database.
- Parameters:
request (Request) – The request object
tour_id (int) – The ID of the tour to be retrieved.
- Returns:
A list of tours, serialized using the UserDiscussionsToursSerializer [
- {
“id”: 1, “tour_name”: “discussions”, “show_tour”: true, “user”: 1
}
]
403 if the tours are disabled
- Return type:
200
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)#
- put(request, tour_id)#
Update an existing tour with the data in the request body.
- Parameters:
request (Request) – The request object
tour_id (int) – The ID of the tour to be updated.
- Returns:
The updated tour, serialized using the UserDiscussionsToursSerializer 404: If the tour does not exist 403: If the user does not have permission to update the tour or the tours are disabled 400: Validation error
- Return type:
200
- class lms.djangoapps.user_tours.v1.views.UserTourView(**kwargs)#
Bases:
RetrieveUpdateAPIViewSupports retrieving and patching the UserTour model
Example Requests
GET /api/user_tours/v1/{username} PATCH /api/user_tours/v1/{username}
- get(request, username)#
Retrieve the User Tour for the given username.
Allows staff users to retrieve any user’s User Tour.
- Returns
- 200 with the following fields:
course_home_tour_status (str): one of UserTour.CourseHomeChoices show_courseware_tour (bool): indicates if courseware tour should be shown.
400 if there is a not allowed request (requesting a user you don’t have access to) 401 if unauthorized request 403 if tours are disabled 404 if the UserTour does not exist (shouldn’t happen, but safety first)
- patch(request, username)#
Patch the User Tour for the request.user.
Supports updating the course_home_tour_status and show_courseware_tour fields.
- Returns:
200 response if update was successful
400 if update was unsuccessful or there was nothing to update 401 if unauthorized request 403 if tours are disabled
- permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)#
- put(*_args, **_kwargs)#
Unsupported method.
- serializer_class#
alias of
UserTourSerializer