BOM-2781: Django codemods on LMS (2) (#28852)
* feat: Django codemods on LMS (2)
This commit is contained in:
@@ -4,13 +4,13 @@ Course Block API URLs
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from .views import BlocksInCourseView, BlocksView
|
||||
|
||||
urlpatterns = [
|
||||
# This endpoint requires the usage_key for the starting block.
|
||||
url(
|
||||
re_path(
|
||||
fr'^v1/blocks/{settings.USAGE_KEY_PATTERN}',
|
||||
BlocksView.as_view(),
|
||||
kwargs={'hide_access_denials': True},
|
||||
@@ -18,22 +18,22 @@ urlpatterns = [
|
||||
),
|
||||
|
||||
# This endpoint is an alternative to the above, but requires course_id as a parameter.
|
||||
url(
|
||||
r'^v1/blocks/',
|
||||
path(
|
||||
'v1/blocks/',
|
||||
BlocksInCourseView.as_view(),
|
||||
kwargs={'hide_access_denials': True},
|
||||
name="blocks_in_course"
|
||||
),
|
||||
# This endpoint requires the usage_key for the starting block.
|
||||
url(
|
||||
re_path(
|
||||
fr'^v2/blocks/{settings.USAGE_KEY_PATTERN}',
|
||||
BlocksView.as_view(),
|
||||
name="blocks_in_block_tree"
|
||||
),
|
||||
|
||||
# This endpoint is an alternative to the above, but requires course_id as a parameter.
|
||||
url(
|
||||
r'^v2/blocks/',
|
||||
path(
|
||||
'v2/blocks/',
|
||||
BlocksInCourseView.as_view(),
|
||||
name="blocks_in_course"
|
||||
),
|
||||
@@ -41,8 +41,8 @@ urlpatterns = [
|
||||
|
||||
if getattr(settings, 'PROVIDER_STATES_URL', None):
|
||||
from .tests.pacts.views import provider_state
|
||||
urlpatterns.append(url(
|
||||
r'^pact/provider_states/$',
|
||||
urlpatterns.append(path(
|
||||
'pact/provider_states/',
|
||||
provider_state,
|
||||
name='provider-state-view'
|
||||
))
|
||||
|
||||
@@ -4,13 +4,13 @@ Course API URLs
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
|
||||
from .views import CourseDetailView, CourseIdListView, CourseListView
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^v1/courses/$', CourseListView.as_view(), name="course-list"),
|
||||
url(fr'^v1/courses/{settings.COURSE_KEY_PATTERN}', CourseDetailView.as_view(), name="course-detail"),
|
||||
url(r'^v1/course_ids/$', CourseIdListView.as_view(), name="course-id-list"),
|
||||
url(r'', include('lms.djangoapps.course_api.blocks.urls'))
|
||||
path('v1/courses/', CourseListView.as_view(), name="course-list"),
|
||||
re_path(fr'^v1/courses/{settings.COURSE_KEY_PATTERN}', CourseDetailView.as_view(), name="course-detail"),
|
||||
path('v1/course_ids/', CourseIdListView.as_view(), name="course-id-list"),
|
||||
path('', include('lms.djangoapps.course_api.blocks.urls'))
|
||||
]
|
||||
|
||||
@@ -8,7 +8,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from edx_django_utils.cache import TieredCache
|
||||
from model_utils import Choices
|
||||
from model_utils.models import TimeStampedModel
|
||||
|
||||
@@ -3,7 +3,7 @@ Course Goals URLs
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
from rest_framework import routers
|
||||
|
||||
from .views import CourseGoalViewSet
|
||||
@@ -12,5 +12,5 @@ router = routers.DefaultRouter()
|
||||
router.register(r'course_goals', CourseGoalViewSet, basename='course_goal')
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^v0/', include((router.urls, "api"), namespace='v0')),
|
||||
path('v0/', include((router.urls, "api"), namespace='v0')),
|
||||
]
|
||||
|
||||
@@ -3,7 +3,7 @@ Django Admin for DisableProgressPageStackedConfig.
|
||||
"""
|
||||
|
||||
from django.contrib import admin
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from openedx.core.djangoapps.config_model_utils.admin import StackedConfigModelAdmin
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Course Home pages.
|
||||
|
||||
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from rest_framework import serializers
|
||||
|
||||
from lms.djangoapps.course_home_api.serializers import VerifiedModeSerializer
|
||||
|
||||
@@ -25,7 +25,7 @@ class Migration(migrations.Migration):
|
||||
('enabled', models.BooleanField(default=None, null=True, verbose_name='Enabled')),
|
||||
('org', models.CharField(blank=True, db_index=True, help_text='Configure values for all course runs associated with this Organization. This is the organization string (i.e. edX, MITx).', max_length=255, null=True)),
|
||||
('org_course', models.CharField(blank=True, db_index=True, help_text="Configure values for all course runs associated with this course. This is should be formatted as 'org+course' (i.e. MITx+6.002x, HarvardX+CS50).", max_length=255, null=True, validators=[openedx.core.djangoapps.config_model_utils.models.validate_course_in_org], verbose_name='Course in Org')),
|
||||
('disabled', models.NullBooleanField(default=None, verbose_name='Disabled')),
|
||||
('disabled', models.BooleanField(default=None, null=True, verbose_name='Disabled')),
|
||||
('changed_by', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='Changed by')),
|
||||
('course', models.ForeignKey(blank=True, help_text='Configure values for this course run. This should be formatted as the CourseKey (i.e. course-v1://MITx+6.002x+2019_Q1)', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='course_overviews.CourseOverview', verbose_name='Course Run')),
|
||||
('site', models.ForeignKey(blank=True, help_text='Configure values for all course runs associated with this site.', null=True, on_delete=django.db.models.deletion.CASCADE, to='sites.Site')),
|
||||
|
||||
@@ -3,7 +3,7 @@ Course home api models file
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from openedx.core.djangoapps.config_model_utils.models import StackedConfigurationModel
|
||||
|
||||
@@ -17,7 +17,7 @@ class DisableProgressPageStackedConfig(StackedConfigurationModel):
|
||||
# Since this config disables the progress page,
|
||||
# it seemed it would be clearer to use a disabled flag instead of an enabled flag.
|
||||
# The enabled field still exists but is not used or shown in the admin.
|
||||
disabled = models.NullBooleanField(default=None, verbose_name=_("Disabled"))
|
||||
disabled = models.BooleanField(default=None, verbose_name=_("Disabled"), null=True)
|
||||
|
||||
def __str__(self):
|
||||
return "DisableProgressPageStackedConfig(disabled={!r})".format(
|
||||
|
||||
@@ -6,7 +6,7 @@ Support for using the CodeMirror code editor as a wiki content editor.
|
||||
from django import forms
|
||||
from django.forms.utils import flatatt
|
||||
from django.template.loader import render_to_string
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.encoding import force_str
|
||||
from django.utils.html import conditional_escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from wiki.editors.base import BaseEditor
|
||||
@@ -41,7 +41,7 @@ class CodeMirrorWidget(forms.Widget):
|
||||
|
||||
return render_to_string('wiki/includes/editor_widget.html',
|
||||
{'attrs': mark_safe(flatatt(final_attrs)),
|
||||
'content': conditional_escape(force_text(value)),
|
||||
'content': conditional_escape(force_str(value)),
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ a user has on an article.
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_noop
|
||||
from django.utils.translation import gettext_noop
|
||||
|
||||
from lms.djangoapps.courseware.tabs import EnrolledTab
|
||||
|
||||
@@ -16,7 +16,7 @@ class WikiTab(EnrolledTab):
|
||||
"""
|
||||
|
||||
type = "wiki"
|
||||
title = ugettext_noop('Wiki')
|
||||
title = gettext_noop('Wiki')
|
||||
view_name = "course_wiki"
|
||||
is_hideable = True
|
||||
is_default = False
|
||||
|
||||
@@ -8,7 +8,7 @@ import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from wiki.core.exceptions import NoRootURL
|
||||
from wiki.models import Article, URLPath
|
||||
|
||||
@@ -3,7 +3,7 @@ This file contains all the classes used by has_access for error handling
|
||||
"""
|
||||
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
from xmodule.course_metadata_utils import DEFAULT_START_DATE
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import datetime
|
||||
|
||||
import pytz
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from django.urls import reverse
|
||||
from common.djangoapps.course_modes.models import CourseMode
|
||||
from openedx.features.course_experience.course_tools import CourseTool
|
||||
|
||||
@@ -13,7 +13,7 @@ from dateutil.parser import parse as parse_date
|
||||
from django.conf import settings
|
||||
from django.http import Http404, QueryDict
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from edx_django_utils.monitoring import function_trace
|
||||
from fs.errors import ResourceNotFound
|
||||
from opaque_keys.edx.keys import UsageKey
|
||||
|
||||
@@ -14,8 +14,8 @@ from django.urls import reverse
|
||||
from django.utils.formats import date_format
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import get_language, to_locale
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import gettext_lazy
|
||||
from lazy import lazy
|
||||
from pytz import utc
|
||||
|
||||
@@ -277,8 +277,8 @@ class CourseStartDate(DateSummary):
|
||||
def title(self):
|
||||
enrollment = CourseEnrollment.get_enrollment(self.user, self.course_id)
|
||||
if enrollment and self.course.end and enrollment.created > self.course.end:
|
||||
return ugettext_lazy('Enrollment Date')
|
||||
return ugettext_lazy('Course starts')
|
||||
return gettext_lazy('Enrollment Date')
|
||||
return gettext_lazy('Course starts')
|
||||
|
||||
def register_alerts(self, request, course):
|
||||
"""
|
||||
@@ -315,7 +315,7 @@ class CourseEndDate(DateSummary):
|
||||
Displays the end date of the course.
|
||||
"""
|
||||
css_class = 'end-date'
|
||||
title = ugettext_lazy('Course ends')
|
||||
title = gettext_lazy('Course ends')
|
||||
is_enabled = True
|
||||
|
||||
@property
|
||||
@@ -482,7 +482,7 @@ class CertificateAvailableDate(DateSummary):
|
||||
Displays the certificate available date of the course.
|
||||
"""
|
||||
css_class = 'certificate-available-date'
|
||||
title = ugettext_lazy('Certificate Available')
|
||||
title = gettext_lazy('Certificate Available')
|
||||
|
||||
@lazy
|
||||
def is_allowed(self):
|
||||
@@ -544,7 +544,7 @@ class VerifiedUpgradeDeadlineDate(DateSummary):
|
||||
Verified track.
|
||||
"""
|
||||
css_class = 'verified-upgrade-deadline'
|
||||
link_text = ugettext_lazy('Upgrade to Verified Certificate')
|
||||
link_text = gettext_lazy('Upgrade to Verified Certificate')
|
||||
|
||||
@property
|
||||
def link(self):
|
||||
|
||||
@@ -12,7 +12,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.db.models import Q
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views import View
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from pytz import utc
|
||||
|
||||
@@ -23,7 +23,7 @@ from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imp
|
||||
from django.db import models
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from model_utils.models import TimeStampedModel
|
||||
from opaque_keys.edx.django.models import BlockTypeKeyField, CourseKeyField, LearningContextKeyField, UsageKeyField
|
||||
from lms.djangoapps.courseware.fields import UnsignedBigIntAutoField
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Dict, Optional
|
||||
from django import urls
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from django.utils.translation import gettext_noop as _
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
@@ -5,8 +5,8 @@ perform some LMS-specific tab display gymnastics for the Entrance Exams feature
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext_noop
|
||||
from django.utils.translation import gettext as _
|
||||
from django.utils.translation import gettext_noop
|
||||
|
||||
from lms.djangoapps.courseware.access import has_access
|
||||
from lms.djangoapps.courseware.entrance_exams import user_can_skip_entrance_exam
|
||||
@@ -33,7 +33,7 @@ class CoursewareTab(EnrolledTab):
|
||||
The main courseware view.
|
||||
"""
|
||||
type = 'courseware'
|
||||
title = ugettext_noop('Course')
|
||||
title = gettext_noop('Course')
|
||||
priority = 10
|
||||
view_name = 'courseware'
|
||||
is_movable = False
|
||||
@@ -68,7 +68,7 @@ class CourseInfoTab(CourseTab):
|
||||
The course info view.
|
||||
"""
|
||||
type = 'course_info'
|
||||
title = ugettext_noop('Home')
|
||||
title = gettext_noop('Home')
|
||||
priority = 20
|
||||
view_name = 'info'
|
||||
tab_id = 'info'
|
||||
@@ -85,7 +85,7 @@ class SyllabusTab(EnrolledTab):
|
||||
A tab for the course syllabus.
|
||||
"""
|
||||
type = 'syllabus'
|
||||
title = ugettext_noop('Syllabus')
|
||||
title = gettext_noop('Syllabus')
|
||||
priority = 30
|
||||
view_name = 'syllabus'
|
||||
allow_multiple = True
|
||||
@@ -103,7 +103,7 @@ class ProgressTab(EnrolledTab):
|
||||
The course progress view.
|
||||
"""
|
||||
type = 'progress'
|
||||
title = ugettext_noop('Progress')
|
||||
title = gettext_noop('Progress')
|
||||
priority = 40
|
||||
view_name = 'progress'
|
||||
is_hideable = True
|
||||
@@ -131,7 +131,7 @@ class TextbookTabsBase(CourseTab):
|
||||
Abstract class for textbook collection tabs classes.
|
||||
"""
|
||||
# Translators: 'Textbooks' refers to the tab in the course that leads to the course' textbooks
|
||||
title = ugettext_noop("Textbooks")
|
||||
title = gettext_noop("Textbooks")
|
||||
is_collection = True
|
||||
is_default = False
|
||||
|
||||
@@ -263,7 +263,7 @@ class ExternalDiscussionCourseTab(LinkTab):
|
||||
|
||||
type = 'external_discussion'
|
||||
# Translators: 'Discussion' refers to the tab in the courseware that leads to the discussion forums
|
||||
title = ugettext_noop('Discussion')
|
||||
title = gettext_noop('Discussion')
|
||||
priority = None
|
||||
is_default = False
|
||||
|
||||
@@ -326,7 +326,7 @@ class DatesTab(EnrolledTab):
|
||||
A tab representing the relevant dates for a course.
|
||||
"""
|
||||
type = "dates"
|
||||
title = ugettext_noop(
|
||||
title = gettext_noop(
|
||||
"Dates") # We don't have the user in this context, so we don't want to translate it at this level.
|
||||
priority = 50
|
||||
view_name = "dates"
|
||||
|
||||
@@ -16,7 +16,7 @@ from django.template.context_processors import csrf
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.decorators.cache import cache_control
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.generic import View
|
||||
|
||||
@@ -22,11 +22,11 @@ from django.shortcuts import redirect
|
||||
from django.template.context_processors import csrf
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.http import urlquote_plus
|
||||
from urllib.parse import quote_plus
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import ugettext
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.utils.translation import ugettext_noop
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.utils.translation import gettext_noop
|
||||
from django.views.decorators.cache import cache_control
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
@@ -680,11 +680,11 @@ class CourseTabView(EdxFragmentView):
|
||||
Text(_("To see course content, {sign_in_link} or {register_link}.")).format(
|
||||
sign_in_link=HTML('<a href="/login?next={current_url}">{sign_in_label}</a>').format(
|
||||
sign_in_label=_("sign in"),
|
||||
current_url=urlquote_plus(request.path),
|
||||
current_url=quote_plus(request.path),
|
||||
),
|
||||
register_link=HTML('<a href="/register?next={current_url}">{register_label}</a>').format(
|
||||
register_label=_("register"),
|
||||
current_url=urlquote_plus(request.path),
|
||||
current_url=quote_plus(request.path),
|
||||
),
|
||||
),
|
||||
once_only=True
|
||||
@@ -695,11 +695,11 @@ class CourseTabView(EdxFragmentView):
|
||||
Text(_("{sign_in_link} or {register_link}.")).format(
|
||||
sign_in_link=HTML('<a href="/login?next={current_url}">{sign_in_label}</a>').format(
|
||||
sign_in_label=_("Sign in"),
|
||||
current_url=urlquote_plus(request.path),
|
||||
current_url=quote_plus(request.path),
|
||||
),
|
||||
register_link=HTML('<a href="/register?next={current_url}">{register_label}</a>').format(
|
||||
register_label=_("register"),
|
||||
current_url=urlquote_plus(request.path),
|
||||
current_url=quote_plus(request.path),
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -1907,11 +1907,11 @@ def _get_fa_header(header):
|
||||
platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)).split('\n')
|
||||
|
||||
|
||||
FA_INCOME_LABEL = ugettext_noop('Annual Household Income')
|
||||
FA_REASON_FOR_APPLYING_LABEL = ugettext_noop('Tell us about your current financial situation. Why do you need assistance?') # lint-amnesty, pylint: disable=line-too-long
|
||||
FA_GOALS_LABEL = ugettext_noop('Tell us about your learning or professional goals. How will a Verified Certificate in this course help you achieve these goals?') # lint-amnesty, pylint: disable=line-too-long
|
||||
FA_INCOME_LABEL = gettext_noop('Annual Household Income')
|
||||
FA_REASON_FOR_APPLYING_LABEL = gettext_noop('Tell us about your current financial situation. Why do you need assistance?') # lint-amnesty, pylint: disable=line-too-long
|
||||
FA_GOALS_LABEL = gettext_noop('Tell us about your learning or professional goals. How will a Verified Certificate in this course help you achieve these goals?') # lint-amnesty, pylint: disable=line-too-long
|
||||
|
||||
FA_EFFORT_LABEL = ugettext_noop('Tell us about your plans for this course. What steps will you take to help you complete the course work and receive a certificate?') # lint-amnesty, pylint: disable=line-too-long
|
||||
FA_EFFORT_LABEL = gettext_noop('Tell us about your plans for this course. What steps will you take to help you complete the course work and receive a certificate?') # lint-amnesty, pylint: disable=line-too-long
|
||||
|
||||
FA_SHORT_ANSWER_INSTRUCTIONS = _('Use between 1250 and 2500 characters or so in your response.')
|
||||
|
||||
@@ -2026,7 +2026,7 @@ def financial_assistance_form(request):
|
||||
'defaultValue': '',
|
||||
'required': True,
|
||||
'options': enrolled_courses,
|
||||
'instructions': ugettext(
|
||||
'instructions': gettext(
|
||||
'Select the course for which you want to earn a verified certificate. If'
|
||||
' the course does not appear in the list, make sure that you have enrolled'
|
||||
' in the audit track for the course.'
|
||||
|
||||
@@ -3,39 +3,42 @@ Base urls for the django_comment_client.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from lms.djangoapps.discussion.django_comment_client.base import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^upload$', views.upload, name='upload'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/update$', views.update_thread, name='update_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/reply$', views.create_comment, name='create_comment'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/delete', views.delete_thread, name='delete_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/upvote$', views.vote_for_thread, {'value': 'up'}, name='upvote_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/downvote$', views.vote_for_thread, {'value': 'down'}, name='downvote_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/flagAbuse$', views.flag_abuse_for_thread, name='flag_abuse_for_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/unFlagAbuse$', views.un_flag_abuse_for_thread,
|
||||
name='un_flag_abuse_for_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/unvote$', views.undo_vote_for_thread, name='undo_vote_for_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/pin$', views.pin_thread, name='pin_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/unpin$', views.un_pin_thread, name='un_pin_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/follow$', views.follow_thread, name='follow_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/unfollow$', views.unfollow_thread, name='unfollow_thread'),
|
||||
url(r'^threads/(?P<thread_id>[\w\-]+)/close$', views.openclose_thread, name='openclose_thread'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/update$', views.update_comment, name='update_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/endorse$', views.endorse_comment, name='endorse_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/reply$', views.create_sub_comment, name='create_sub_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/delete$', views.delete_comment, name='delete_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/upvote$', views.vote_for_comment, {'value': 'up'}, name='upvote_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/downvote$', views.vote_for_comment, {'value': 'down'},
|
||||
name='downvote_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/unvote$', views.undo_vote_for_comment, name='undo_vote_for_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/flagAbuse$', views.flag_abuse_for_comment, name='flag_abuse_for_comment'),
|
||||
url(r'^comments/(?P<comment_id>[\w\-]+)/unFlagAbuse$', views.un_flag_abuse_for_comment,
|
||||
name='un_flag_abuse_for_comment'),
|
||||
url(r'^(?P<commentable_id>[\w\-.]+)/threads/create$', views.create_thread, name='create_thread'),
|
||||
url(r'^(?P<commentable_id>[\w\-.]+)/follow$', views.follow_commentable, name='follow_commentable'),
|
||||
url(r'^(?P<commentable_id>[\w\-.]+)/unfollow$', views.unfollow_commentable, name='unfollow_commentable'),
|
||||
url(r'^users$', views.users, name='users'),
|
||||
path('upload', views.upload, name='upload'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/update$', views.update_thread, name='update_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/reply$', views.create_comment, name='create_comment'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/delete', views.delete_thread, name='delete_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/upvote$', views.vote_for_thread, {'value': 'up'}, name='upvote_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/downvote$', views.vote_for_thread, {'value': 'down'},
|
||||
name='downvote_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/flagAbuse$', views.flag_abuse_for_thread, name='flag_abuse_for_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/unFlagAbuse$', views.un_flag_abuse_for_thread,
|
||||
name='un_flag_abuse_for_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/unvote$', views.undo_vote_for_thread, name='undo_vote_for_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/pin$', views.pin_thread, name='pin_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/unpin$', views.un_pin_thread, name='un_pin_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/follow$', views.follow_thread, name='follow_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/unfollow$', views.unfollow_thread, name='unfollow_thread'),
|
||||
re_path(r'^threads/(?P<thread_id>[\w\-]+)/close$', views.openclose_thread, name='openclose_thread'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/update$', views.update_comment, name='update_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/endorse$', views.endorse_comment, name='endorse_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/reply$', views.create_sub_comment, name='create_sub_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/delete$', views.delete_comment, name='delete_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/upvote$', views.vote_for_comment,
|
||||
{'value': 'up'}, name='upvote_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/downvote$', views.vote_for_comment, {'value': 'down'},
|
||||
name='downvote_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/unvote$', views.undo_vote_for_comment, name='undo_vote_for_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/flagAbuse$', views.flag_abuse_for_comment,
|
||||
name='flag_abuse_for_comment'),
|
||||
re_path(r'^comments/(?P<comment_id>[\w\-]+)/unFlagAbuse$', views.un_flag_abuse_for_comment,
|
||||
name='un_flag_abuse_for_comment'),
|
||||
re_path(r'^(?P<commentable_id>[\w\-.]+)/threads/create$', views.create_thread, name='create_thread'),
|
||||
re_path(r'^(?P<commentable_id>[\w\-.]+)/follow$', views.follow_commentable, name='follow_commentable'),
|
||||
re_path(r'^(?P<commentable_id>[\w\-.]+)/unfollow$', views.unfollow_commentable, name='unfollow_commentable'),
|
||||
path('users', views.users, name='users'),
|
||||
]
|
||||
|
||||
@@ -11,7 +11,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.core import exceptions
|
||||
from django.http import Http404, HttpResponse, HttpResponseServerError
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from django.views.decorators import csrf
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from django.views.decorators.http import require_GET, require_POST
|
||||
|
||||
@@ -3,8 +3,8 @@ Urls for the django_comment_client.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
url(r'', include('lms.djangoapps.discussion.django_comment_client.base.urls')),
|
||||
path('', include('lms.djangoapps.discussion.django_comment_client.base.urls')),
|
||||
]
|
||||
|
||||
@@ -4,7 +4,7 @@ Views handling read (GET) requests for the Discussion tab and inline discussions
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_noop
|
||||
from django.utils.translation import gettext_noop
|
||||
|
||||
import lms.djangoapps.discussion.django_comment_client.utils as utils
|
||||
from lms.djangoapps.courseware.tabs import EnrolledTab
|
||||
@@ -18,7 +18,7 @@ class DiscussionTab(TabFragmentViewMixin, EnrolledTab):
|
||||
"""
|
||||
|
||||
type = 'discussion'
|
||||
title = ugettext_noop('Discussion')
|
||||
title = gettext_noop('Discussion')
|
||||
priority = None
|
||||
view_name = 'forum_form_discussion'
|
||||
fragment_view_name = 'lms.djangoapps.discussion.views.DiscussionBoardFragmentView'
|
||||
|
||||
@@ -5,7 +5,7 @@ Discussion API URLs
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import include, path, re_path
|
||||
from rest_framework.routers import SimpleRouter
|
||||
|
||||
from lms.djangoapps.discussion.rest_api.views import (
|
||||
@@ -25,36 +25,36 @@ ROUTER.register("threads", ThreadViewSet, basename="thread")
|
||||
ROUTER.register("comments", CommentViewSet, basename="comment")
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r"^v1/courses/{}/settings$".format(
|
||||
settings.COURSE_ID_PATTERN
|
||||
),
|
||||
CourseDiscussionSettingsAPIView.as_view(),
|
||||
name="discussion_course_settings",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
fr"^v1/courses/{settings.COURSE_ID_PATTERN}/upload$",
|
||||
UploadFileView.as_view(),
|
||||
name="upload_file",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r"^v1/courses/{}/roles/(?P<rolename>[A-Za-z0-9+ _-]+)/?$".format(
|
||||
settings.COURSE_ID_PATTERN
|
||||
),
|
||||
CourseDiscussionRolesAPIView.as_view(),
|
||||
name="discussion_course_roles",
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
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(
|
||||
path('v1/accounts/retire_forum', RetireUserView.as_view(), name="retire_discussion_user"),
|
||||
path('v1/accounts/replace_username', ReplaceUsernamesView.as_view(), name="replace_discussion_username"),
|
||||
re_path(
|
||||
fr"^v1/course_topics/{settings.COURSE_ID_PATTERN}",
|
||||
CourseTopicsView.as_view(),
|
||||
name="course_topics"
|
||||
),
|
||||
url("^v1/", include(ROUTER.urls)),
|
||||
path('v1/', include(ROUTER.urls)),
|
||||
]
|
||||
|
||||
@@ -3,20 +3,19 @@ Forum urls for the django_comment_client.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'users/(?P<user_id>\w+)/followed$', views.followed_threads, name='followed_threads'),
|
||||
url(r'users/(?P<user_id>\w+)$', views.user_profile, name='user_profile'),
|
||||
url(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', views.single_thread,
|
||||
name='single_thread'),
|
||||
url(r'^(?P<discussion_id>[\w\-.]+)/inline$', views.inline_discussion, name='inline_discussion'),
|
||||
url(
|
||||
r'discussion_board_fragment_view$',
|
||||
re_path(r'users/(?P<user_id>\w+)/followed$', views.followed_threads, name='followed_threads'),
|
||||
re_path(r'users/(?P<user_id>\w+)$', views.user_profile, name='user_profile'),
|
||||
re_path(r'^(?P<discussion_id>[\w\-.]+)/threads/(?P<thread_id>\w+)$', views.single_thread, name='single_thread'),
|
||||
re_path(r'^(?P<discussion_id>[\w\-.]+)/inline$', views.inline_discussion, name='inline_discussion'),
|
||||
path(
|
||||
'discussion_board_fragment_view',
|
||||
views.DiscussionBoardFragmentView.as_view(),
|
||||
name='discussion_board_fragment_view'
|
||||
),
|
||||
url(r'', views.forum_form_discussion, name='forum_form_discussion'),
|
||||
re_path('', views.forum_form_discussion, name='forum_form_discussion'),
|
||||
]
|
||||
|
||||
@@ -14,7 +14,7 @@ from django.shortcuts import render
|
||||
from django.template.context_processors import csrf
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import get_language_bidi, ugettext_lazy as _
|
||||
from django.utils.translation import get_language_bidi, gettext_lazy as _
|
||||
from django.views.decorators.cache import cache_control
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from django.views.decorators.http import require_GET, require_http_methods
|
||||
|
||||
Reference in New Issue
Block a user