fix: fixed django4 warnings (#29643)
This commit is contained in:
committed by
GitHub
parent
23690712ba
commit
a838ab4b01
@@ -1,12 +1,12 @@
|
||||
"""
|
||||
Demographics API URLs.
|
||||
"""
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import path, include
|
||||
|
||||
from .v1 import urls as v1_urls
|
||||
|
||||
app_name = 'openedx.core.djangoapps.demographics'
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^v1/', include(v1_urls))
|
||||
path('v1/', include(v1_urls))
|
||||
]
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
"""
|
||||
URL Routes for this app.
|
||||
"""
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from .views import DemographicsStatusView
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
r'^demographics/status/$',
|
||||
DemographicsStatusView.as_view(),
|
||||
name='demographics_status'
|
||||
),
|
||||
path('demographics/status/', DemographicsStatusView.as_view(),
|
||||
name='demographics_status'
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
"""URLs served by the embargo app. """
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
|
||||
from django.urls import path, re_path
|
||||
from .views import CheckCourseAccessView, CourseAccessMessageView
|
||||
|
||||
app_name = 'embargo'
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r'^blocked-message/(?P<access_point>enrollment|courseware)/(?P<message_key>.+)/$',
|
||||
CourseAccessMessageView.as_view(),
|
||||
name='blocked_message',
|
||||
),
|
||||
url(r'^v1/course_access/$', CheckCourseAccessView.as_view(), name='v1_course_access'),
|
||||
path('v1/course_access/', CheckCourseAccessView.as_view(), name='v1_course_access'),
|
||||
]
|
||||
|
||||
@@ -5,7 +5,7 @@ URLs for the Enrollment API
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
|
||||
from .views import (
|
||||
CourseEnrollmentsApiListView,
|
||||
@@ -17,16 +17,16 @@ from .views import (
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^enrollment/{username},{course_key}$'.format(
|
||||
re_path(r'^enrollment/{username},{course_key}$'.format(
|
||||
username=settings.USERNAME_PATTERN,
|
||||
course_key=settings.COURSE_ID_PATTERN),
|
||||
EnrollmentView.as_view(), name='courseenrollment'),
|
||||
url(fr'^enrollment/{settings.COURSE_ID_PATTERN}$',
|
||||
EnrollmentView.as_view(), name='courseenrollment'),
|
||||
url(r'^enrollment$', EnrollmentListView.as_view(), name='courseenrollments'),
|
||||
url(r'^enrollments/?$', CourseEnrollmentsApiListView.as_view(), name='courseenrollmentsapilist'),
|
||||
url(fr'^course/{settings.COURSE_ID_PATTERN}$',
|
||||
EnrollmentCourseDetailView.as_view(), name='courseenrollmentdetails'),
|
||||
url(r'^unenroll/$', UnenrollmentView.as_view(), name='unenrollment'),
|
||||
url(r'^roles/$', EnrollmentUserRolesView.as_view(), name='roles'),
|
||||
re_path(fr'^enrollment/{settings.COURSE_ID_PATTERN}$',
|
||||
EnrollmentView.as_view(), name='courseenrollment'),
|
||||
path('enrollment', EnrollmentListView.as_view(), name='courseenrollments'),
|
||||
re_path(r'^enrollments/?$', CourseEnrollmentsApiListView.as_view(), name='courseenrollmentsapilist'),
|
||||
re_path(fr'^course/{settings.COURSE_ID_PATTERN}$',
|
||||
EnrollmentCourseDetailView.as_view(), name='courseenrollmentdetails'),
|
||||
path('unenroll/', UnenrollmentView.as_view(), name='unenrollment'),
|
||||
path('roles/', EnrollmentUserRolesView.as_view(), name='roles'),
|
||||
]
|
||||
|
||||
@@ -3,12 +3,11 @@ import csv
|
||||
from logging import getLogger
|
||||
|
||||
from django import forms
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin, messages
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse
|
||||
from django.urls import path, reverse
|
||||
|
||||
from .models import ExternalId, ExternalIdType
|
||||
|
||||
@@ -34,11 +33,9 @@ class ExternalIdAdmin(admin.ModelAdmin): # lint-amnesty, pylint: disable=missin
|
||||
def get_urls(self):
|
||||
urls = super().get_urls()
|
||||
custom_urls = [
|
||||
url(
|
||||
r'^bulk_generate_external_ids/$',
|
||||
self.admin_site.admin_view(self.generate_ids_form),
|
||||
name='bulk_generate_external_ids'
|
||||
),
|
||||
path('bulk_generate_external_ids/', self.admin_site.admin_view(self.generate_ids_form),
|
||||
name='bulk_generate_external_ids'
|
||||
),
|
||||
]
|
||||
return custom_urls + urls
|
||||
|
||||
|
||||
@@ -4,22 +4,20 @@ OAuth2 wrapper urls
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import path, re_path
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^authorize/?$', csrf_exempt(views.AuthorizationView.as_view()), name='authorize'),
|
||||
url(r'^access_token/?$', csrf_exempt(views.AccessTokenView.as_view()), name='access_token'),
|
||||
url(r'^revoke_token/?$', csrf_exempt(views.RevokeTokenView.as_view()), name='revoke_token'),
|
||||
re_path(r'^authorize/?$', csrf_exempt(views.AuthorizationView.as_view()), name='authorize'),
|
||||
re_path(r'^access_token/?$', csrf_exempt(views.AccessTokenView.as_view()), name='access_token'),
|
||||
re_path(r'^revoke_token/?$', csrf_exempt(views.RevokeTokenView.as_view()), name='revoke_token'),
|
||||
]
|
||||
|
||||
if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'):
|
||||
urlpatterns += [
|
||||
url(
|
||||
r'^exchange_access_token/(?P<backend>[^/]+)/$',
|
||||
csrf_exempt(views.AccessTokenExchangeView.as_view()),
|
||||
name='exchange_access_token',
|
||||
),
|
||||
path('exchange_access_token/<str:backend>/', csrf_exempt(views.AccessTokenExchangeView.as_view()),
|
||||
name='exchange_access_token',
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
"""
|
||||
Studio URL configuration for openedx-olx-rest-api.
|
||||
"""
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import path, include
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^api/olx-export/v1/', include([
|
||||
url(r'xblock/(?P<usage_key_str>[^/]+)/$', views.get_block_olx),
|
||||
path('api/olx-export/v1/', include([
|
||||
path('xblock/<str:usage_key_str>/', views.get_block_olx),
|
||||
# Get a static file from an XBlock that's not part of contentstore/GridFS
|
||||
url(r'xblock-export-file/(?P<usage_key_str>[^/]+)/(?P<path>.+)$', views.get_block_exportfs_file),
|
||||
path('xblock-export-file/<str:usage_key_str>/<path:path>', views.get_block_exportfs_file),
|
||||
])),
|
||||
]
|
||||
|
||||
@@ -9,17 +9,17 @@ NOTE: These views are deprecated. These routes are superseded by
|
||||
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import ProfileImageRemoveView, ProfileImageUploadView
|
||||
|
||||
urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r'^v1/' + settings.USERNAME_PATTERN + '/upload$',
|
||||
ProfileImageUploadView.as_view(),
|
||||
name="profile_image_upload"
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^v1/' + settings.USERNAME_PATTERN + '/remove$',
|
||||
ProfileImageRemoveView.as_view(),
|
||||
name="profile_image_remove"
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
"""
|
||||
Django URLs for service status app
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
from openedx.core.djangoapps.service_status.views import celery_ping, celery_status, index
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', index, name='status.service.index'),
|
||||
url(r'^celery/$', celery_status, name='status.service.celery.status'),
|
||||
url(r'^celery/ping/$', celery_ping, name='status.service.celery.ping'),
|
||||
path('', index, name='status.service.index'),
|
||||
path('celery/', celery_status, name='status.service.celery.status'),
|
||||
path('celery/ping/', celery_ping, name='status.service.celery.ping'),
|
||||
]
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<%namespace name='static' file='../static_content.html'/>
|
||||
|
||||
<%!
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import gettext as _
|
||||
from openedx.core.djangoapps.theming.helpers import get_themes
|
||||
%>
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
"""
|
||||
Defines URLs for theming views.
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.urls import path
|
||||
|
||||
from . import helpers
|
||||
@@ -21,9 +18,7 @@ urlpatterns = [
|
||||
|
||||
if helpers.is_comprehensive_theming_enabled():
|
||||
urlpatterns += [
|
||||
url(
|
||||
r"^admin",
|
||||
views.ThemingAdministrationFragmentView.as_view(),
|
||||
name="openedx.theming.update_theme_fragment_view",
|
||||
),
|
||||
path('admin', views.ThemingAdministrationFragmentView.as_view(),
|
||||
name="openedx.theming.update_theme_fragment_view",
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
"""
|
||||
Django admin configuration pages for the user_api app
|
||||
"""
|
||||
|
||||
|
||||
from django.conf.urls import url
|
||||
from django.contrib import admin, messages
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.http import HttpResponseForbidden, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.urls import reverse
|
||||
from django.urls import path, reverse
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext as _
|
||||
|
||||
@@ -89,11 +86,9 @@ class UserRetirementStatusAdmin(admin.ModelAdmin):
|
||||
"""
|
||||
urls = super().get_urls()
|
||||
custom_urls = [
|
||||
url(
|
||||
r'^(?P<retirement_id>.+)/cancel_retirement/$',
|
||||
self.admin_site.admin_view(self.cancel_retirement),
|
||||
name='cancel-retirement',
|
||||
),
|
||||
path('<path:retirement_id>/cancel_retirement/', self.admin_site.admin_view(self.cancel_retirement),
|
||||
name='cancel-retirement',
|
||||
),
|
||||
]
|
||||
return custom_urls + urls
|
||||
|
||||
|
||||
@@ -349,12 +349,13 @@ class FormDescription:
|
||||
|
||||
class LocalizedJSONEncoder(DjangoJSONEncoder):
|
||||
"""
|
||||
JSON handler that evaluates ugettext_lazy promises.
|
||||
JSON handler that evaluates gettext_lazy promises.
|
||||
"""
|
||||
# pylint: disable=method-hidden
|
||||
|
||||
def default(self, obj): # lint-amnesty, pylint: disable=arguments-differ
|
||||
"""
|
||||
Forces evaluation of ugettext_lazy promises.
|
||||
Forces evaluation of gettext_lazy promises.
|
||||
"""
|
||||
if isinstance(obj, Promise):
|
||||
return force_str(obj)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Defines the URL routes for this app.
|
||||
"""
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import path, re_path, include
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views as user_api_views
|
||||
@@ -13,24 +13,20 @@ USER_API_ROUTER.register(r'users', user_api_views.UserViewSet)
|
||||
USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^account/settings$', account_settings, name='account_settings'),
|
||||
url(r'^user_api/v1/', include(USER_API_ROUTER.urls)),
|
||||
url(
|
||||
path('account/settings', account_settings, name='account_settings'),
|
||||
path('user_api/v1/', include(USER_API_ROUTER.urls)),
|
||||
re_path(
|
||||
fr'^user_api/v1/preferences/(?P<pref_key>{UserPreference.KEY_REGEX})/users/$',
|
||||
user_api_views.PreferenceUsersListView.as_view()
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^user_api/v1/forum_roles/(?P<name>[a-zA-Z]+)/users/$',
|
||||
user_api_views.ForumRoleUsersListView.as_view()
|
||||
),
|
||||
|
||||
url(
|
||||
r'^user_api/v1/preferences/email_opt_in/$',
|
||||
user_api_views.UpdateEmailOptInPreference.as_view(),
|
||||
name="preferences_email_opt_in_legacy"
|
||||
),
|
||||
url(
|
||||
r'^user_api/v1/preferences/time_zones/$',
|
||||
user_api_views.CountryTimeZoneListView.as_view(),
|
||||
),
|
||||
path('user_api/v1/preferences/email_opt_in/', user_api_views.UpdateEmailOptInPreference.as_view(),
|
||||
name="preferences_email_opt_in_legacy"
|
||||
),
|
||||
path('user_api/v1/preferences/time_zones/', user_api_views.CountryTimeZoneListView.as_view(),
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user