* Python code cleanup by the cleanup-python-code Jenkins job. This pull request was generated by the cleanup-python-code Jenkins job, which ran ``` cd lms/djangoapps/dashboard; find . -type f -name '*.py' | while read fname; do sed -i 's/ # lint-amnesty, pylint: disable=super-with-arguments//; s/ # lint-amnesty, pylint: disable=import-error, wrong-import-order//; s/ # lint-amnesty, pylint: disable=wrong-import-order//' "$fname"; done; find . -type f -name '*.py' | while read fname; do pyupgrade --exit-zero-even-if-changed --py3-plus --py36-plus --py38-plus "$fname"; done; isort --recursive . ``` The following packages were installed: `pyupgrade,isort` * feedback done Co-authored-by: Zulqarnain <muhammad.zulqarnain@arbisoft.com>
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
# pylint: skip-file
|
|
"""
|
|
Discussion API URLs
|
|
"""
|
|
|
|
|
|
from django.conf import settings
|
|
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", ReplaceUsernamesView.as_view(), name="replace_discussion_username"),
|
|
url(
|
|
fr"^v1/course_topics/{settings.COURSE_ID_PATTERN}",
|
|
CourseTopicsView.as_view(),
|
|
name="course_topics"
|
|
),
|
|
url("^v1/", include(ROUTER.urls)),
|
|
]
|