Esempio n. 1
0
from django.conf.urls import include, url
from rest_framework.routers import SimpleRouter

from lms.djangoapps.discussion.rest_api.views import (
    CommentViewSet, CourseDiscussionRolesAPIView,
    CourseDiscussionSettingsAPIView, CourseTopicsView, CourseView,
    ReplaceUsernamesView, RetireUserView, ThreadViewSet)

ROUTER = SimpleRouter()
ROUTER.register("threads", ThreadViewSet, basename="thread")
ROUTER.register("comments", CommentViewSet, basename="comment")

urlpatterns = [
    url(
        r"^v1/courses/{}/settings$".format(settings.COURSE_ID_PATTERN),
        CourseDiscussionSettingsAPIView.as_view(),
        name="discussion_course_settings",
    ),
    url(
        r"^v1/courses/{}/roles/(?P<rolename>[A-Za-z0-9+ _-]+)/?$".format(
            settings.COURSE_ID_PATTERN),
        CourseDiscussionRolesAPIView.as_view(),
        name="discussion_course_roles",
    ),
    url(fr"^v1/courses/{settings.COURSE_ID_PATTERN}",
        CourseView.as_view(),
        name="discussion_course"),
    url(r"^v1/accounts/retire_forum",
        RetireUserView.as_view(),
        name="retire_discussion_user"),
    url(r"^v1/accounts/replace_username",
Esempio n. 2
0
    CourseView,
    ThreadViewSet,
    RetireUserView,
    ReplaceUsernamesView,
)

ROUTER = SimpleRouter()
ROUTER.register("threads", ThreadViewSet, base_name="thread")
ROUTER.register("comments", CommentViewSet, base_name="comment")

urlpatterns = [
    url(
        r"^v1/courses/{}/settings$".format(
            settings.COURSE_ID_PATTERN
        ),
        CourseDiscussionSettingsAPIView.as_view(),
        name="discussion_course_settings",
    ),
    url(
        r"^v1/courses/{}/roles/(?P<rolename>[A-Za-z0-9+ _-]+)/?$".format(
            settings.COURSE_ID_PATTERN
        ),
        CourseDiscussionRolesAPIView.as_view(),
        name="discussion_course_roles",
    ),
    url(
        r"^v1/courses/{}".format(settings.COURSE_ID_PATTERN),
        CourseView.as_view(),
        name="discussion_course"
    ),
    url(r"^v1/accounts/retire_forum", RetireUserView.as_view(), name="retire_discussion_user"),