fix: fixed django40 warnings (#29641)
* fix: fixed django4 warnings Co-authored-by: UsamaSadiq <usama.sadiq@arbisoft.com>
This commit is contained in:
committed by
GitHub
parent
e8953398ac
commit
dd488a76d1
@@ -11,12 +11,12 @@ from datetime import timedelta
|
||||
|
||||
import ddt
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.http import HttpResponse
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.timezone import now
|
||||
from django.urls import path
|
||||
from oauth2_provider import models as dot_models
|
||||
from rest_framework import status
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
@@ -44,14 +44,12 @@ class MockView(APIView): # pylint: disable=missing-docstring
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^oauth2-inactive-test/$',
|
||||
MockView.as_view(authentication_classes=[authentication.BearerAuthenticationAllowInactiveUser])
|
||||
),
|
||||
url(
|
||||
r'^oauth2-test/$',
|
||||
MockView.as_view(authentication_classes=[authentication.BearerAuthentication])
|
||||
)
|
||||
path('oauth2-inactive-test/',
|
||||
MockView.as_view(authentication_classes=[authentication.BearerAuthenticationAllowInactiveUser])
|
||||
),
|
||||
path('oauth2-test/',
|
||||
MockView.as_view(authentication_classes=[authentication.BearerAuthentication])
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
Tests for (some of) the view utilities.
|
||||
"""
|
||||
from django.conf.urls import url
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import re_path
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.test import APITestCase
|
||||
from rest_framework.views import APIView
|
||||
@@ -28,7 +28,7 @@ class MockAPIView(DeveloperErrorViewMixin, APIView):
|
||||
return Response(f"Success {course_id}")
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^mock/(?P<course_id>.*)/$', MockAPIView.as_view()), # Only works with new-style course keys
|
||||
re_path(r'^mock/(?P<course_id>.*)/$', MockAPIView.as_view()), # Only works with new-style course keys
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
"""
|
||||
Defines URLs for announcements in the LMS.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.urls import path
|
||||
|
||||
from .views import AnnouncementsJSONView
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^page/(?P<page>\d+)$',
|
||||
login_required(AnnouncementsJSONView.as_view()),
|
||||
name='page',
|
||||
),
|
||||
path('page/<int:page>', login_required(AnnouncementsJSONView.as_view()),
|
||||
name='page',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
Defines URLs for Calendar Sync.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from django.urls import path
|
||||
from .views.calendar_sync import CalendarSyncView
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^calendar_sync$',
|
||||
CalendarSyncView.as_view(),
|
||||
name='openedx.calendar_sync',
|
||||
),
|
||||
path('calendar_sync', CalendarSyncView.as_view(),
|
||||
name='openedx.calendar_sync',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -2,20 +2,14 @@
|
||||
Defines URLs for course bookmarks.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from django.urls import path
|
||||
from .views.course_bookmarks import CourseBookmarksFragmentView, CourseBookmarksView
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^$',
|
||||
CourseBookmarksView.as_view(),
|
||||
name='openedx.course_bookmarks.home',
|
||||
),
|
||||
url(
|
||||
r'^bookmarks_fragment$',
|
||||
CourseBookmarksFragmentView.as_view(),
|
||||
name='openedx.course_bookmarks.course_bookmarks_fragment_view',
|
||||
),
|
||||
path('', CourseBookmarksView.as_view(),
|
||||
name='openedx.course_bookmarks.home',
|
||||
),
|
||||
path('bookmarks_fragment', CourseBookmarksFragmentView.as_view(),
|
||||
name='openedx.course_bookmarks.course_bookmarks_fragment_view',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
Defines URLs for the course experience.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from django.urls import path
|
||||
from .views.course_dates import CourseDatesFragmentMobileView
|
||||
from .views.course_home import CourseHomeFragmentView, CourseHomeView
|
||||
from .views.course_outline import CourseOutlineFragmentView
|
||||
@@ -16,49 +14,31 @@ COURSE_HOME_VIEW_NAME = 'openedx.course_experience.course_home'
|
||||
COURSE_DATES_FRAGMENT_VIEW_NAME = 'openedx.course_experience.mobile_dates_fragment_view'
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^$',
|
||||
CourseHomeView.as_view(),
|
||||
name=COURSE_HOME_VIEW_NAME,
|
||||
),
|
||||
url(
|
||||
r'^updates$',
|
||||
CourseUpdatesView.as_view(),
|
||||
name='openedx.course_experience.course_updates',
|
||||
),
|
||||
url(
|
||||
r'^home_fragment$',
|
||||
CourseHomeFragmentView.as_view(),
|
||||
name='openedx.course_experience.course_home_fragment_view',
|
||||
),
|
||||
url(
|
||||
r'^outline_fragment$',
|
||||
CourseOutlineFragmentView.as_view(),
|
||||
name='openedx.course_experience.course_outline_fragment_view',
|
||||
),
|
||||
url(
|
||||
r'^updates_fragment$',
|
||||
CourseUpdatesFragmentView.as_view(),
|
||||
name='openedx.course_experience.course_updates_fragment_view',
|
||||
),
|
||||
url(
|
||||
r'^welcome_message_fragment$',
|
||||
WelcomeMessageFragmentView.as_view(),
|
||||
name='openedx.course_experience.welcome_message_fragment_view',
|
||||
),
|
||||
url(
|
||||
r'^latest_update_fragment$',
|
||||
LatestUpdateFragmentView.as_view(),
|
||||
name='openedx.course_experience.latest_update_fragment_view',
|
||||
),
|
||||
url(
|
||||
r'^dismiss_welcome_message$',
|
||||
dismiss_welcome_message,
|
||||
name='openedx.course_experience.dismiss_welcome_message',
|
||||
),
|
||||
url(
|
||||
r'^mobile_dates_fragment',
|
||||
CourseDatesFragmentMobileView.as_view(),
|
||||
name=COURSE_DATES_FRAGMENT_VIEW_NAME,
|
||||
),
|
||||
path('', CourseHomeView.as_view(),
|
||||
name=COURSE_HOME_VIEW_NAME,
|
||||
),
|
||||
path('updates', CourseUpdatesView.as_view(),
|
||||
name='openedx.course_experience.course_updates',
|
||||
),
|
||||
path('home_fragment', CourseHomeFragmentView.as_view(),
|
||||
name='openedx.course_experience.course_home_fragment_view',
|
||||
),
|
||||
path('outline_fragment', CourseOutlineFragmentView.as_view(),
|
||||
name='openedx.course_experience.course_outline_fragment_view',
|
||||
),
|
||||
path('updates_fragment', CourseUpdatesFragmentView.as_view(),
|
||||
name='openedx.course_experience.course_updates_fragment_view',
|
||||
),
|
||||
path('welcome_message_fragment', WelcomeMessageFragmentView.as_view(),
|
||||
name='openedx.course_experience.welcome_message_fragment_view',
|
||||
),
|
||||
path('latest_update_fragment', LatestUpdateFragmentView.as_view(),
|
||||
name='openedx.course_experience.latest_update_fragment_view',
|
||||
),
|
||||
path('dismiss_welcome_message', dismiss_welcome_message,
|
||||
name='openedx.course_experience.dismiss_welcome_message',
|
||||
),
|
||||
path('mobile_dates_fragment', CourseDatesFragmentMobileView.as_view(),
|
||||
name=COURSE_DATES_FRAGMENT_VIEW_NAME,
|
||||
),
|
||||
]
|
||||
|
||||
@@ -2,20 +2,14 @@
|
||||
Defines URLs for course search.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from django.urls import path
|
||||
from .views.course_search import CourseSearchFragmentView, CourseSearchView
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^$',
|
||||
CourseSearchView.as_view(),
|
||||
name='openedx.course_search.course_search_results',
|
||||
),
|
||||
url(
|
||||
r'^home_fragment$',
|
||||
CourseSearchFragmentView.as_view(),
|
||||
name='openedx.course_search.course_search_results_fragment_view',
|
||||
),
|
||||
path('', CourseSearchView.as_view(),
|
||||
name='openedx.course_search.course_search_results',
|
||||
),
|
||||
path('home_fragment', CourseSearchFragmentView.as_view(),
|
||||
name='openedx.course_search.course_search_results_fragment_view',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -4,13 +4,13 @@ Discount API URLs
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import CourseUserDiscount, CourseUserDiscountWithUserParam
|
||||
|
||||
urlpatterns = [
|
||||
url(fr'^course/{settings.COURSE_KEY_PATTERN}', CourseUserDiscount.as_view(), name='course_user_discount'),
|
||||
url(fr'^user/(?P<user_id>[^/]*)/course/{settings.COURSE_KEY_PATTERN}',
|
||||
CourseUserDiscountWithUserParam.as_view(),
|
||||
name='course_user_discount_with_param'),
|
||||
re_path(fr'^course/{settings.COURSE_KEY_PATTERN}', CourseUserDiscount.as_view(), name='course_user_discount'),
|
||||
re_path(fr'^user/(?P<user_id>[^/]*)/course/{settings.COURSE_KEY_PATTERN}',
|
||||
CourseUserDiscountWithUserParam.as_view(),
|
||||
name='course_user_discount_with_param'),
|
||||
]
|
||||
|
||||
@@ -4,23 +4,21 @@ Defines URLs for the learner profile.
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from openedx.features.learner_profile.views.learner_profile import learner_profile
|
||||
|
||||
from .views.learner_achievements import LearnerAchievementsFragmentView
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r'^{username_pattern}$'.format(
|
||||
username_pattern=settings.USERNAME_PATTERN,
|
||||
),
|
||||
learner_profile,
|
||||
name='learner_profile',
|
||||
),
|
||||
url(
|
||||
r'^achievements$',
|
||||
LearnerAchievementsFragmentView.as_view(),
|
||||
name='openedx.learner_profile.learner_achievements_fragment_view',
|
||||
),
|
||||
path('achievements', LearnerAchievementsFragmentView.as_view(),
|
||||
name='openedx.learner_profile.learner_achievements_fragment_view',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -7,7 +7,7 @@ from urllib.parse import quote
|
||||
from django.contrib.auth.models import AbstractBaseUser
|
||||
from django.contrib.sites.shortcuts import get_current_site
|
||||
from django.http import HttpRequest
|
||||
from django.utils.translation import get_language, to_locale, gettext_lazy
|
||||
from django.utils.translation import get_language, gettext_lazy, to_locale
|
||||
from lti_consumer.api import get_lti_pii_sharing_state_for_course
|
||||
from lti_consumer.lti_1p1.contrib.django import lti_embed
|
||||
from lti_consumer.models import LtiConfiguration
|
||||
|
||||
@@ -8,7 +8,7 @@ from crum import get_current_request
|
||||
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import ngettext, gettext as _
|
||||
from django.utils.translation import gettext as _, ngettext
|
||||
|
||||
from xmodule.util.misc import is_xblock_an_assignment
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""
|
||||
Coverage Context Listener URLs.
|
||||
"""
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from .views import update_context
|
||||
|
||||
urlpatterns = [
|
||||
url(r'update_context', update_context),
|
||||
path('update_context', update_context),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user